Add mitigation with task and mapping import
Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
5
pkg/coredata/migrations/20250401T144700Z.sql
Normal file
5
pkg/coredata/migrations/20250401T144700Z.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE tasks ADD COLUMN reference_id TEXT DEFAULT '';
|
||||
ALTER TABLE tasks ALTER COLUMN reference_id SET NOT NULL;
|
||||
ALTER TABLE tasks ALTER COLUMN reference_id DROP DEFAULT;
|
||||
|
||||
ALTER TABLE tasks ADD CONSTRAINT tasks_reference_id_unique UNIQUE (id, reference_id);
|
||||
3
pkg/coredata/migrations/20250401T165000Z.sql
Normal file
3
pkg/coredata/migrations/20250401T165000Z.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE mitigations RENAME COLUMN content_ref TO reference_id;
|
||||
ALTER TABLE mitigations ADD CONSTRAINT mitigations_org_ref_unique UNIQUE (organization_id, reference_id);
|
||||
ALTER TABLE mitigations DROP COLUMN standards;
|
||||
1
pkg/coredata/migrations/20250401T171500Z.sql
Normal file
1
pkg/coredata/migrations/20250401T171500Z.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE mitigations DROP COLUMN version;
|
||||
11
pkg/coredata/migrations/20250401T173800Z.sql
Normal file
11
pkg/coredata/migrations/20250401T173800Z.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
ALTER TABLE controls_mitigations
|
||||
ADD CONSTRAINT fk_controls_mitigations_control_id
|
||||
FOREIGN KEY (control_id)
|
||||
REFERENCES controls(id)
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE controls_mitigations
|
||||
ADD CONSTRAINT fk_controls_mitigations_mitigation_id
|
||||
FOREIGN KEY (mitigation_id)
|
||||
REFERENCES mitigations(id)
|
||||
ON DELETE CASCADE;
|
||||
2
pkg/coredata/migrations/20250401T175300Z.sql
Normal file
2
pkg/coredata/migrations/20250401T175300Z.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE tasks DROP CONSTRAINT tasks_reference_id_unique;
|
||||
ALTER TABLE tasks ADD CONSTRAINT tasks_reference_id_unique UNIQUE (mitigation_id, reference_id);
|
||||
3
pkg/coredata/migrations/20250401T175400Z.sql
Normal file
3
pkg/coredata/migrations/20250401T175400Z.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE controls
|
||||
DROP CONSTRAINT IF EXISTS controls_framework_ref_unique,
|
||||
ADD CONSTRAINT controls_framework_ref_unique UNIQUE (framework_id, reference_id);
|
||||
Reference in New Issue
Block a user