Reset controls framework foreign key
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
10
pkg/coredata/migrations/20250716T155448Z.sql
Normal file
10
pkg/coredata/migrations/20250716T155448Z.sql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
ALTER TABLE controls DROP CONSTRAINT IF EXISTS controls_framework_id_fkey;
|
||||||
|
|
||||||
|
DELETE FROM controls
|
||||||
|
WHERE framework_id NOT IN (SELECT id FROM frameworks);
|
||||||
|
|
||||||
|
ALTER TABLE controls
|
||||||
|
ADD CONSTRAINT controls_framework_id_fkey
|
||||||
|
FOREIGN KEY (framework_id)
|
||||||
|
REFERENCES frameworks(id)
|
||||||
|
ON DELETE CASCADE;
|
||||||
Reference in New Issue
Block a user