mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fix, mysql db:purge
respects Rails.env
.
Previously this method always established a connection to the test database. This resulted in buggy behavior when combined with other tasks like `bin/rake db:schema:load`. This was one of the reasons why #15394 (22e9a91189
) was reverted: > I’ve replicated it on a new app by the following commands: 1) rails generate model post:title, 2) rake db:migrate, 3) rake db:schema:load, 4) rails runner ‘puts Post.first’. The last command goes boom. Problem is that rake db:schema:load wipes the database, and then doesn’t actually restore it. This is all on MySQL. There’s no problem with SQLite. -- DHH22e9a91189 (commitcomment-6834245)
This commit is contained in:
parent
a208fb7647
commit
091b246bb0
2 changed files with 5 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
* `db:purge` with MySQL respects `Rails.env`.
|
||||
|
||||
*Yves Senn*
|
||||
|
||||
* `change_column_default :table, :column, nil` with PostgreSQL will issue a
|
||||
`DROP DEFAULT` instead of a `DEFAULT NULL` query.
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def purge
|
||||
establish_connection :test
|
||||
establish_connection configuration
|
||||
connection.recreate_database configuration['database'], creation_options
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue