Skip to content

Commit

Permalink
Merge pull request #2936 from joelmoss/migration_status
Browse files Browse the repository at this point in the history
db:migrate:status not looking at all migration paths
  • Loading branch information
spastorino committed Sep 12, 2011
2 parents 96d63e1 + dffd058 commit 90cd024
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions activerecord/lib/active_record/railties/databases.rake
Expand Up @@ -203,11 +203,13 @@ db_namespace = namespace :db do
end
db_list = ActiveRecord::Base.connection.select_values("SELECT version FROM #{ActiveRecord::Migrator.schema_migrations_table_name}")
file_list = []
Dir.foreach(File.join(Rails.root, 'db', 'migrate')) do |file|
# 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].humanize]
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)
status = db_list.delete(match_data[1]) ? 'up' : 'down'
file_list << [status, match_data[1], match_data[2].humanize]
end
end
end
db_list.map! do |version|
Expand Down

0 comments on commit 90cd024

Please sign in to comment.