-
Notifications
You must be signed in to change notification settings - Fork 17
Disable defer_foreign_keys during sqlite migration #407
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
base: master
Are you sure you want to change the base?
Disable defer_foreign_keys during sqlite migration #407
Conversation
butane_core/src/db/sqlite.rs
Outdated
| let stmts: [&str; 4] = [ | ||
| // Wrap in PRAGMA defer_foreign_keys to allow dropping tables that are referenced | ||
| let stmts: [&str; 6] = [ | ||
| "PRAGMA defer_foreign_keys = ON;", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I like this, but it does solve one of our rollback problems.
8f42c37 to
ffeef6e
Compare
ffeef6e to
0e8162e
Compare
| //future improvement: support column renames | ||
| /// Disable constraint enforcement before migration operations. | ||
| /// Used when operations require temporarily disabling foreign key checks or other constraints. | ||
| DisableConstraints, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I'm still not sure about this.
Perhaps rename to Preamble and Postamble/Epilogue , to be a bit more generic.
To be truely useful for allowing workarounds for complex situations, I feel that these new Ops should have arguments of old and new ADB, so that the backend has the full context and can then provide complex logic. But that feels like cheating.
Fixes one of #226