diff options
author | Peter Mitchell <petmit@gmail.com> | 2012-02-17 16:56:57 +0100 |
---|---|---|
committer | Peter Mitchell <petmit@gmail.com> | 2012-02-17 16:58:11 +0100 |
commit | 910c59fffe4cd4e61eef66202951ad19155cc34a (patch) | |
tree | e00b4c35b32c2b083dae18fcd4c98b7a630f4d2e /activerecord | |
parent | b9ad097565968332acb6e91fc602459f035639a9 (diff) | |
download | rails-910c59fffe4cd4e61eef66202951ad19155cc34a.tar.gz rails-910c59fffe4cd4e61eef66202951ad19155cc34a.tar.bz2 rails-910c59fffe4cd4e61eef66202951ad19155cc34a.zip |
Correctly print names of non-timestamped migrations with db:migrate:status
Diffstat (limited to 'activerecord')
-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 |