diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2015-11-02 15:12:12 +0000 |
---|---|---|
committer | Andrew White <pixeltrix@users.noreply.github.com> | 2015-11-02 15:12:12 +0000 |
commit | 38ddfefe54558659554909464d41f9072d21d6ee (patch) | |
tree | 926637cc1a2686e5abb86ec3288aaca0818f9289 /activerecord/lib/active_record/railties | |
parent | 22e17695672f266c85e36ed36d847fc3f65d5dea (diff) | |
parent | a7beeb7faac405de0f78c39dbfb7240a584d0d10 (diff) | |
download | rails-38ddfefe54558659554909464d41f9072d21d6ee.tar.gz rails-38ddfefe54558659554909464d41f9072d21d6ee.tar.bz2 rails-38ddfefe54558659554909464d41f9072d21d6ee.zip |
Merge pull request #21841 from yui-knk/fix_migration_status
Make `db:migrate:status` to render `1_some.rb` format migrate files.
Diffstat (limited to 'activerecord/lib/active_record/railties')
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index b6f3695856..5b1ea16f0b 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -100,12 +100,14 @@ db_namespace = namespace :db do file_list = ActiveRecord::Tasks::DatabaseTasks.migrations_paths.flat_map do |path| - # match "20091231235959_some_name.rb" and "001_some_name.rb" pattern - Dir.foreach(path).grep(/^(\d{3,})_(.+)\.rb$/) do - version = ActiveRecord::SchemaMigration.normalize_migration_number($1) + Dir.foreach(path).map do |file| + next unless ActiveRecord::Migrator.match_to_migration_filename?(file) + + version, name, scope = ActiveRecord::Migrator.parse_migration_filename(file) + version = ActiveRecord::SchemaMigration.normalize_migration_number(version) status = db_list.delete(version) ? 'up' : 'down' - [status, version, $2.humanize] - end + [status, version, (name + scope).humanize] + end.compact end db_list.map! do |version| |