提交 e5851215 编写于 作者: C Christopher Wade

Interleave db_list and file_list.

上级 2952040f
...@@ -203,18 +203,18 @@ db_namespace = namespace :db do ...@@ -203,18 +203,18 @@ db_namespace = namespace :db do
# only files matching "20091231235959_some_name.rb" pattern # only files matching "20091231235959_some_name.rb" pattern
if match_data = /^(\d{14})_(.+)\.rb$/.match(file) if match_data = /^(\d{14})_(.+)\.rb$/.match(file)
status = db_list.delete(match_data[1]) ? 'up' : 'down' 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
end end
db_list.map! do |version|
['up', version, '********** NO FILE **********']
end
# output # output
puts "\ndatabase: #{config['database']}\n\n" puts "\ndatabase: #{config['database']}\n\n"
puts "#{'Status'.center(8)} #{'Migration ID'.ljust(14)} Migration Name" puts "#{'Status'.center(8)} #{'Migration ID'.ljust(14)} Migration Name"
puts "-" * 50 puts "-" * 50
file_list.sort_by {|file| file[1]}.each do |file| (db_list + file_list).sort_by {|migration| migration[1]}.each do |migration|
puts "#{file[0].center(8)} #{file[1].ljust(14)} #{file[2].humanize}" puts "#{migration[0].center(8)} #{migration[1].ljust(14)} #{migration[2]}"
end
db_list.sort.each do |version|
puts "#{'up'.center(8)} #{version.ljust(14)} *** NO FILE ***"
end end
puts puts
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册