-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
disable_ddl_transaction! is a misleading name #21044
Comments
👍 I agree. I also find it misleading because you're not disabling all transactions for the duration of the entire migration, just that the migration as a whole is wrapped in a transaction. (You can still start up transactions/ddl transactions on your own). The rails guides and the rdoc don't really mention that fact anywhere and more generally say:
Which would imply to me that you can't run any DDL transactions at all, which isn't true 😕 I think clarifying the docs could go a long way or renaming the method could help. Some suggestions I have could be: |
I agree that the name could be better. The 👍 on making the docs more clear. I'm not sure we have to change the name though. |
I think the documentation on the [ |
Same here 👍 for doc change. |
disable_ddl_transaction!
is used in AR migrations to prevent your migration from being wrapped in a transaction. The name is misleading because your entire migration will have transactions disabled, not just for DDL SQL statements.If I have a migration that contains a mixture of DDL and DML SQL, and declare
disable_ddl_transaction!
at the top of my migration, I would still expect DML to be wrapped in a transaction, but this is not the case, as the DML SQL statements are still executed outside of a transaction.If the desired behavior is to disable only DDL transactions, then I would consider this a bug, but I believe the intent of this method is to prevent your entire migration from running in a transaction, and thus the method is poorly named. Perhaps
disable_transaction!
would be more appropriate?The text was updated successfully, but these errors were encountered: