-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-add options to drop_table #5052
Comments
Done in my pull request. I'm only waiting someone to merge it. Thanks for reporting. |
Thanks. I'm also open to other solutions, because this requires that Rails knows about an external gem. |
Can this also go into 3-2-stable? |
I think so. @tenderlove could you cherry-pick this commit? |
rafaelfranca
added a commit
to rafaelfranca/omg-rails
that referenced
this issue
Feb 27, 2012
Options is needed for some Rails extensions to determine when referential integrity should be disabled This reverts commit bcb466c. Fixes rails#5052
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Rails 3.0 and Rails 3.1, the method signature for drop_table was
In Rails 3.2, it changed to
The options hash is used by foreigner to determine whether disable_referential_integrity should be called:
https://github.com/matthuhiggins/foreigner/blob/master/lib/foreigner/connection_adapters/sql2003.rb#L8
On Rails 3.2, no options are passed, so :force is always false. This ultimately prevents "rake db:schema:load" from working on databases with foreign_keys, which means running "rake test" also breaks.
I created a sample app that causes this problem at https://github.com/matthuhiggins/broken_foreign_keys. Run the following to reproduce:
You will see this error:
```Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails: DROP TABLE
shoes
The text was updated successfully, but these errors were encountered: