Repository navigation
feat(datagrid): show the rows a cascading delete changes before it runs - #3703
Merged
Merged
Conversation
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.
Summary
ON DELETE CASCADEup to 5 keys deep, and counts the rows each key deletes, sets to NULL or default, or protects, with read-onlySELECT COUNT(*)queries.RESTRICTorNO ACTIONkey with rows behind it says the save will fail. Rows the same save deletes anyway are left out of block and rewrite counts.ON UPDATErule on a rewritten key), other schemas, an open transaction the counts cannot see, key columns the same save edits, and "Ignore foreign key checks" on a staged table operation.PRAGMA foreign_keys, MySQLforeign_key_checks): the prompt says nothing cascades instead of listing counts.ON DELETEandON UPDATE; before, every key read asNO ACTION. The per-table and schema-wide reads share one query, and the iOS app passes the actions through.Test plan
CascadeDeletePlanTests,ReferencingKeyTests,CascadeDeleteSQLTests,CascadeDeletePreviewerTests,BulkDeleteConfirmationTests(TableProTests).BulkDeleteConfirmationTestschanged on purpose: the title now names the table.MSSQLSchemaQueriesTests(TableProMSSQLCoreTests): action columns, the schema-wide query,NO_ACTION/SET_NULLparsing.apple/scripts/probes/check-sqlite-cascade-delete-counts.shagainst SQLite 3.54.0: the generated counts equal what the DELETE removes and nulls (15/60/9), and the parent's collation and affinity apply.Not in this PR
finishSuccessfulSaveinRowEditingCoordinator+SaveChanges.swift).PRAGMA foreign_keys = ONeven when the session had it off (fkEnableStatements), which turns cascades on for later saves.NO ACTIONand SQLite checksRESTRICTrow by row, so deleting a parent and its child in one save can still fail there although the prompt leaves those rows out of the blockers.Fixes #3616