Skip to content

fix: Add ON DELETE CASCADE to WebFeatures foreign keys#1691

Merged
jcscottiii merged 2 commits intomainfrom
jcscottiii/fk-feature-test
Aug 5, 2025
Merged

fix: Add ON DELETE CASCADE to WebFeatures foreign keys#1691
jcscottiii merged 2 commits intomainfrom
jcscottiii/fk-feature-test

Conversation

@jcscottiii
Copy link
Collaborator

@jcscottiii jcscottiii commented Aug 4, 2025

Fixes #513

Previously, deleting a record from the WebFeatures table would fail if it was referenced by other tables.

This change updates all foreign key constraints that reference WebFeatures(ID) to include ON DELETE CASCADE. This ensures that when a feature is deleted, all its associated data in other tables is automatically removed.

The constraints have also been given explicit names to improve schema manageability. An integration test has been added to verify the cascade behavior across all related tables and prevent regressions.


After this PR is merged, I will manually adjust the constraints. The constraints currently have random names across staging and prod.

Base automatically changed from jcscottiii/cleanup-group-tables to main August 4, 2025 20:01
Fixes #513

Previously, deleting a record from the WebFeatures table would fail if it was referenced by other tables.

This change updates all foreign key constraints that reference WebFeatures(ID) to include ON DELETE CASCADE. This ensures that when a feature is deleted, all its associated data in other tables is automatically removed.

The constraints have also been given explicit names to improve schema manageability. An integration test has been added to verify the cascade behavior across all related tables and prevent regressions.
@jcscottiii jcscottiii force-pushed the jcscottiii/fk-feature-test branch from b3950f0 to 2b0fd55 Compare August 4, 2025 20:46
@jcscottiii jcscottiii requested a review from jrobbins August 4, 2025 21:13
@jcscottiii jcscottiii enabled auto-merge August 5, 2025 13:42
@jcscottiii jcscottiii added this pull request to the merge queue Aug 5, 2025
Merged via the queue into main with commit 6843f91 Aug 5, 2025
7 checks passed
@jcscottiii jcscottiii deleted the jcscottiii/fk-feature-test branch August 5, 2025 14:12
@jstenback jstenback mentioned this pull request Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Add missing ON DELETE CASCADE constraints on some tables

2 participants