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 |
# File 'lib/redmine_plugins_helper/migration/database.rb', line 15 def from_database ::ActiveRecord::SchemaMigration.create_table ::ActiveRecord::SchemaMigration.all.pluck(:version).map do |version| from_database_version(version) end end |
#from_database_version(version) ⇒ RedminePluginsHelper::Migration
23 24 25 26 27 28 |
# File 'lib/redmine_plugins_helper/migration/database.rb', line 23 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 |