diff options
author | Akira Matsuda <ronnie@dio.jp> | 2010-06-28 12:12:36 +0900 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-06-27 21:16:34 -0700 |
commit | 4f74d449eee1e3d1621ed032532076492a1bf0b3 (patch) | |
tree | 866d1a8d875746edcc73f676ccd8e5738b9216bf /activerecord | |
parent | 0e5d7c6f6458d279c59d34f1e37289e338784e7b (diff) | |
download | rails-4f74d449eee1e3d1621ed032532076492a1bf0b3.tar.gz rails-4f74d449eee1e3d1621ed032532076492a1bf0b3.tar.bz2 rails-4f74d449eee1e3d1621ed032532076492a1bf0b3.zip |
Avoid "no such table" exception when schema migrations table does not exist
[#4990 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 3cb6d63727..cfa84cbb76 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -175,6 +175,11 @@ namespace :db do desc "Display status of migrations" task :status => :environment do config = ActiveRecord::Base.configurations[Rails.env || 'development'] + ActiveRecord::Base.establish_connection(config) + unless ActiveRecord::Base.connection.table_exists?(ActiveRecord::Migrator.schema_migrations_table_name) + puts 'Schema migrations table does not exist yet.' + next # means "return" for rake task + 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| |