Skip to content
Browse files

Return a non zero code when db has never been setup on status

  • Loading branch information...
1 parent 6b2f377 commit d1fa1fc35a2f11cb0349698ba47ca87c78b4002e @paulRbr paulRbr committed with rafaelfranca May 6, 2014
View
3 activerecord/lib/active_record/railties/databases.rake
@@ -83,8 +83,7 @@ db_namespace = namespace :db do
desc 'Display status of migrations'
task :status => [:environment, :load_config] do
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
+ abort 'Schema migrations table does not exist yet.'
end
db_list = ActiveRecord::Base.connection.select_values("SELECT version FROM #{ActiveRecord::Migrator.schema_migrations_table_name}")
db_list.map! { |version| "%.3d" % version }
View
2 railties/test/application/rake/migrations_test.rb
@@ -58,7 +58,7 @@ class AMigration < ActiveRecord::Migration
end
test 'migration status when schema migrations table is not present' do
- output = Dir.chdir(app_path){ `rake db:migrate:status` }
+ output = Dir.chdir(app_path){ `rake db:migrate:status 2>&1` }
assert_equal "Schema migrations table does not exist yet.\n", output
end

0 comments on commit d1fa1fc

Please sign in to comment.
Something went wrong with that request. Please try again.