Add test: transform does not cascade-delete referencing records#792
Merged
Conversation
Covers running transform against a table involved in an ON DELETE CASCADE foreign key relationship while PRAGMA foreign_keys is on. Dropping the old table during transform must not trigger the cascade and delete records from the referencing table. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StxDiBxEbsv8VBmqxamgUV
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #792 +/- ##
=======================================
Coverage 95.55% 95.55%
=======================================
Files 9 9
Lines 3798 3798
=======================================
Hits 3629 3629
Misses 169 169 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StxDiBxEbsv8VBmqxamgUV
There was a problem hiding this comment.
Pull request overview
This PR adds regression coverage for sqlite_utils.Table.transform() to ensure that transforming (drop/recreate/rename) a table does not trigger unintended ON DELETE CASCADE behavior that would delete rows in referencing tables when PRAGMA foreign_keys is enabled.
Changes:
- Adds a new parametrized test that exercises
transform()withPRAGMA foreign_keysboth disabled and enabled. - Validates that transforming a referenced (“parent”) table does not cascade-delete rows in the referencing (“child”) table.
- Confirms that data remains intact across transforms for both involved tables under the cascade foreign key setup.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01StxDiBxEbsv8VBmqxamgUV
📚 Documentation preview 📚: https://sqlite-utils--792.org.readthedocs.build/en/792/