Module: RedminePluginsHelper::Migration::Database::ClassMethods
- Defined in:
- lib/redmine_plugins_helper/migration/database.rb
Instance Method Summary collapse
- #from_database ⇒ Enumerable<RedminePluginsHelper::Migration>
- #from_database_version(version) ⇒ RedminePluginsHelper::Migration
Instance Method Details
#from_database ⇒ Enumerable<RedminePluginsHelper::Migration>
15 16 17 18 19 20 21 |
# File 'lib/redmine_plugins_helper/migration/database.rb', line 15 def from_database schema_migration = ::ActiveRecord::Base.connection_pool.schema_migration schema_migration.create_table schema_migration.versions.map do |version| from_database_version(version) end end |
#from_database_version(version) ⇒ RedminePluginsHelper::Migration
24 25 26 27 28 29 |
# File 'lib/redmine_plugins_helper/migration/database.rb', line 24 def from_database_version(version) DATABASE_VERSION_PARSERS .lazy .map { |parser| parser.parse(version).if_present { |args| new(*args) } } .find(&:present?) || raise("None parser parsed \"#{version}\"") end |