Use PRAGMA defer_foreign_keys instead of PRAGMA foreign_keys when migrating#35873
Use PRAGMA defer_foreign_keys instead of PRAGMA foreign_keys when migrating#35873cincuranet merged 7 commits intodotnet:mainfrom ferferga:pragma-defer-fk
PRAGMA defer_foreign_keys instead of PRAGMA foreign_keys when migrating#35873Conversation
… migrating defer_foreign_keys is specifically tailored to be used inside SQLite transactions. Reference issue: #35871
|
@dotnet-policy-service agree |
cincuranet
left a comment
There was a problem hiding this comment.
This looks good. Thanks.
|
Removing the explicit |
|
Yeah. It made tests very angry. :) |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Tests |
Signed-off-by: GitHub <noreply@github.com>
|
|
@ferferga I took over and fixed the two tests. When (if) the CI is green, I'll merge today. Thanks for your contribution! |
|
@cincuranet Sorry, I didn't see those modifications were in main and I had to update my branch. When I first fixed the tests it was really late here and did it quick (so I didn't bother running the checks locally or waiting for CI 😅). Today I was finally available again and just right now I was spinning up a Codespace to fix them, but thank you very much for being faster than me! 😊 One question I have now: I noticed that, instead of using Let me know what do you think, luckily it's just a find&replace thing. |
|
I personally like |
|
Would it be possible to get this released any sooner than .NET 11, maybe in 10.0.2? In any case, thank your for fixing this. |
|
10.0.2 window is already closed. So far it is unlikely that it's going to be backported to any 10.x version. But we are constantly evaluating the possibility of backports, based on user feedback. |
This Pull Request changes the use of
PRAGMA foreign_keysin SQLite migrations toPRAGMA defer_foreign_keys, which are allowed inside transactionss without any issue.It's one of the possible fixes for #35871, and I think the best one, since we will use the exact pragma that SQLite wants to be used for transactions, instead of working around it.
I did my best attempt to update the tests as well, but not sure this is how I should do it (since I didn't see any mention to
BEGIN TRANSACTIONinside the generated SQL in tests.