aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-09 09:54:04 -0700
committerJosé Valim <jose.valim@gmail.com>2011-05-09 09:54:04 -0700
commit5b4849598a2cd3c9aaa3b73fcf14ec90fc56f879 (patch)
treed075882704418d40c1b82e14de68b8faa7866cdb /activerecord/lib/active_record
parent59705deeaf3861caff1016e59da47708870f33ba (diff)
parente585121539b4f0f311023068b0a7543b3ae14a2d (diff)
downloadrails-5b4849598a2cd3c9aaa3b73fcf14ec90fc56f879.tar.gz
rails-5b4849598a2cd3c9aaa3b73fcf14ec90fc56f879.tar.bz2
rails-5b4849598a2cd3c9aaa3b73fcf14ec90fc56f879.zip
Merge pull request #461 from chrislwade/sorted-migrations
Sorted migrations
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/railties/databases.rake12
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake
index c6bc040f9f..85ad43b35f 100644
--- a/activerecord/lib/active_record/railties/databases.rake
+++ b/activerecord/lib/active_record/railties/databases.rake
@@ -203,18 +203,18 @@ db_namespace = namespace :db do
# only files matching "20091231235959_some_name.rb" pattern
if match_data = /^(\d{14})_(.+)\.rb$/.match(file)
status = db_list.delete(match_data[1]) ? 'up' : 'down'
- file_list << [status, match_data[1], match_data[2]]
+ file_list << [status, match_data[1], match_data[2].humanize]
end
end
+ db_list.map! do |version|
+ ['up', version, '********** NO FILE **********']
+ end
# output
puts "\ndatabase: #{config['database']}\n\n"
puts "#{'Status'.center(8)} #{'Migration ID'.ljust(14)} Migration Name"
puts "-" * 50
- file_list.each do |file|
- puts "#{file[0].center(8)} #{file[1].ljust(14)} #{file[2].humanize}"
- end
- db_list.each do |version|
- puts "#{'up'.center(8)} #{version.ljust(14)} *** NO FILE ***"
+ (db_list + file_list).sort_by {|migration| migration[1]}.each do |migration|
+ puts "#{migration[0].center(8)} #{migration[1].ljust(14)} #{migration[2]}"
end
puts
end