Make framework reference id uniq

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-31 15:28:43 +02:00
parent 77a89074bd
commit 5a7b0c8ec9
2 changed files with 36 additions and 1 deletions

View File

@@ -0,0 +1,9 @@
ALTER TABLE frameworks
ALTER COLUMN reference_id SET NOT NULL,
DROP CONSTRAINT IF EXISTS frameworks_reference_id_unique,
ADD CONSTRAINT frameworks_org_ref_unique UNIQUE (organization_id, reference_id);
ALTER TABLE controls
ALTER COLUMN reference_id DROP DEFAULT,
DROP CONSTRAINT IF EXISTS controls_reference_id_unique,
ADD CONSTRAINT controls_framework_ref_unique UNIQUE (framework_id, reference_id);