mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
rake:db:test:prepare falls back to original environment after execution.
This commit is contained in:
parent
ca2bc303a9
commit
56445c9075
2 changed files with 11 additions and 3 deletions
|
@ -35,5 +35,9 @@
|
|||
* Abort a rake task when missing db/structure.sql like `db:schema:load` task.
|
||||
|
||||
*kennyj*
|
||||
|
||||
* rake:db:test:prepare falls back to original environment after execution.
|
||||
|
||||
*Slava Markevich*
|
||||
|
||||
Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/activerecord/CHANGELOG.md) for previous changes.
|
||||
|
|
|
@ -319,9 +319,13 @@ db_namespace = namespace :db do
|
|||
|
||||
# desc "Recreate the test database from an existent schema.rb file"
|
||||
task :load_schema => 'db:test:purge' do
|
||||
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
|
||||
ActiveRecord::Schema.verbose = false
|
||||
db_namespace["schema:load"].invoke
|
||||
begin
|
||||
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
|
||||
ActiveRecord::Schema.verbose = false
|
||||
db_namespace["schema:load"].invoke
|
||||
ensure
|
||||
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[Rails.env])
|
||||
end
|
||||
end
|
||||
|
||||
# desc "Recreate the test database from an existent structure.sql file"
|
||||
|
|
Loading…
Reference in a new issue