diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-17 10:05:28 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-17 10:05:28 -0800 |
commit | 663c9f30c60d4082cbcb77db80d809ee512e06c2 (patch) | |
tree | e00b4c35b32c2b083dae18fcd4c98b7a630f4d2e /activerecord/lib | |
parent | b9ad097565968332acb6e91fc602459f035639a9 (diff) | |
parent | 910c59fffe4cd4e61eef66202951ad19155cc34a (diff) | |
download | rails-663c9f30c60d4082cbcb77db80d809ee512e06c2.tar.gz rails-663c9f30c60d4082cbcb77db80d809ee512e06c2.tar.bz2 rails-663c9f30c60d4082cbcb77db80d809ee512e06c2.zip |
Merge pull request #5076 from petmit/migrate_status_without_timestamps
Correctly print names of non-timestamped migrations with db:migrate:status
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 067117a465..14bb0a724e 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -207,11 +207,12 @@ db_namespace = namespace :db do next # means "return" for rake task end db_list = ActiveRecord::Base.connection.select_values("SELECT version FROM #{ActiveRecord::Migrator.schema_migrations_table_name}") + db_list.map! { |version| "%.3d" % version } file_list = [] ActiveRecord::Migrator.migrations_paths.each do |path| Dir.foreach(path) do |file| - # only files matching "20091231235959_some_name.rb" pattern - if match_data = /^(\d{14})_(.+)\.rb$/.match(file) + # match "20091231235959_some_name.rb" and "001_some_name.rb" pattern + if match_data = /^(\d{3,})_(.+)\.rb$/.match(file) status = db_list.delete(match_data[1]) ? 'up' : 'down' file_list << [status, match_data[1], match_data[2].humanize] end |