Permalink
Browse files

Extract AR::SchemaMigration.normalized_versions method

  • Loading branch information...
1 parent 0813607 commit 68b7e7ab9776d26d69bc84037ba81c68dd38885b @DNNX DNNX committed Jun 27, 2014
@@ -96,8 +96,7 @@ db_namespace = namespace :db do
unless ActiveRecord::Base.connection.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name)
abort 'Schema migrations table does not exist yet.'
end
- db_list = ActiveRecord::SchemaMigration.pluck(:version)
- db_list.map! { |version| ActiveRecord::SchemaMigration.normalize_migration_number(version) }
+ db_list = ActiveRecord::SchemaMigration.normalized_versions
file_list =
ActiveRecord::Migrator.migrations_paths.flat_map do |path|
@@ -43,6 +43,10 @@ def drop_table
def normalize_migration_number(number)
"%.3d" % number.to_i
end
+
+ def normalized_versions
+ pluck(:version).map { |v| normalize_migration_number v }
+ end
end
def version

0 comments on commit 68b7e7a

Please sign in to comment.