Rename snapshot cleanup migration and use third_parties table

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-05-20 12:46:54 +02:00
parent f41dd9566b
commit ec2bbccdbd

View File

@@ -17,14 +17,14 @@
-- table, controls_snapshots, snapshots_type enum, snapshot-scoped indexes) is -- table, controls_snapshots, snapshots_type enum, snapshot-scoped indexes) is
-- dropped in a follow-up migration. -- dropped in a follow-up migration.
-- processing_activity_vendors stores snapshot_id without an FK to snapshots, so -- processing_activity_third_parties stores snapshot_id without an FK to snapshots,
-- the cascade delete below would not reach it. Clean it up explicitly first. -- so the cascade delete below would not reach it. Clean it up explicitly first.
DELETE FROM processing_activity_vendors WHERE snapshot_id IS NOT NULL; DELETE FROM processing_activity_third_parties WHERE snapshot_id IS NOT NULL;
-- Every other table with a snapshot_id has a FOREIGN KEY (snapshot_id) REFERENCES -- Every other table with a snapshot_id has a FOREIGN KEY (snapshot_id) REFERENCES
-- snapshots(id) ON DELETE CASCADE, so deleting all snapshots removes every -- snapshots(id) ON DELETE CASCADE, so deleting all snapshots removes every
-- snapshot-scoped row across data, vendors, assets, risks, findings, obligations, -- snapshot-scoped row across data, third_parties, assets, risks, findings,
-- processing_activities, statements_of_applicability, applicability_statements, -- obligations, processing_activities, statements_of_applicability,
-- the vendor_* sub-tables, the processing_activity DPIA/TIA tables, and the -- applicability_statements, the third_party_* sub-tables, the processing_activity
-- controls_snapshots junction. -- DPIA/TIA tables, and the controls_snapshots junction.
DELETE FROM snapshots; DELETE FROM snapshots;