diff options
author | Viktar Basharymau <viktar.basharymau@thehamon.com> | 2014-06-27 20:16:21 +0300 |
---|---|---|
committer | Viktar Basharymau <viktar.basharymau@thehamon.com> | 2014-06-27 20:16:21 +0300 |
commit | 68b7e7ab9776d26d69bc84037ba81c68dd38885b (patch) | |
tree | ae422dc67dcca0b80b2af9e47363f24726530543 /activerecord/lib | |
parent | 0813607c7004ab06d35ae75ba205b97cf37122a2 (diff) | |
download | rails-68b7e7ab9776d26d69bc84037ba81c68dd38885b.tar.gz rails-68b7e7ab9776d26d69bc84037ba81c68dd38885b.tar.bz2 rails-68b7e7ab9776d26d69bc84037ba81c68dd38885b.zip |
Extract AR::SchemaMigration.normalized_versions method
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 3 | ||||
-rw-r--r-- | activerecord/lib/active_record/schema_migration.rb | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index c82a56718a..d7621646d9 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -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| diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb index 3a004d58c9..b5038104ac 100644 --- a/activerecord/lib/active_record/schema_migration.rb +++ b/activerecord/lib/active_record/schema_migration.rb @@ -43,6 +43,10 @@ module ActiveRecord 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 |