-
Notifications
You must be signed in to change notification settings - Fork 22
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
Idea: only disable DDL transaction for transactions that use helpers #58
Comments
We could discuss that a bit, are you proposing to explicitly include the concern to be able to use monkey patched migration methods? What do you think about: automatically disabling transaction when using non-transaction compatible methods (like index or foreign key ones), otherwise keep the default transaction. We would need to handle cases such as add_column :foo, :bar, :text
add_index :foo, :bar where we could either automatically commit the transaction before the add_index, or simply let the migration fail because of ADD INDEX CONCURRENTLY being executed inside a transaction, and let the developer do it in a separate migration. And we also need to adapt the retry mechanism to work correctly with transactional migration, as we would not be able to execute any more statement in an aborted transaction |
That would be ideal.
Do you think it is possible? As I understand it, the migration runner checks One mechanism capable of analysing what is inside the Of course, I had On the other hand, developers don't have to keep in mind what to do if a migration with disabled DDL transaction worked only partially.
I am not sure if I entirely understand what you mean. |
I was getting curious why my So it seems like there's a confirmed way to selectively disable the transaction only for those migrations that use overridden helpers. |
That is practically achievable by providing a
SafeMigration
concern that users could include in their migrations.It will:
This approach would still allow having migrations that have DDL transaction turned on.
The text was updated successfully, but these errors were encountered: