SQLite: allow foreign_key_check for whole DB, not just a single table#2479
Merged
SQLite: allow foreign_key_check for whole DB, not just a single table#2479
foreign_key_check for whole DB, not just a single table#2479Conversation
anonrig
approved these changes
Aug 6, 2024
|
I'm so glad to see it happening. I'm struggling with this at this very moment, and from what I see, it should help me. If it's not too hard, can you please post a comment when this reaches production? 🙏 |
Contributor
|
Out of curiosity, what was the rationale for blocking the whole-DB check? I imagine it can be pretty expensive. Can it result in a full scan of the entire database? |
Contributor
Author
|
I'm not sure. From looking at the code, we didn't have a There's nothing stopping users from enumerating all the tables and calling |
4fdcf7e to
5945e55
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In response to #2471, it would be useful to allow some migrations to completely disable foreign key constraints. However, at the end of the migration, it might be important to know whether any foreign key violations remain, before setting
PRAGMA foreign_keys=ON;.This is possible by using
PRAGMA foreign_key_check;, but right now we only allow that if it contains a single argument, indicating a table name. This PR allows both no-arg and single-arg forms of that pragma.