Change data enum

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-06-09 13:20:01 -07:00
parent 13b7bfcc74
commit df3b43cd18
19 changed files with 348 additions and 236 deletions

View File

@@ -0,0 +1,24 @@
CREATE TYPE data_classification_type AS ENUM (
'PUBLIC',
'INTERNAL',
'CONFIDENTIAL',
'SECRET'
);
ALTER TABLE data
ADD COLUMN data_classification data_classification_type;
UPDATE data
SET data_classification = CASE
WHEN data_sensitivity = 'NONE' THEN 'PUBLIC'::data_classification_type
WHEN data_sensitivity = 'LOW' THEN 'INTERNAL'::data_classification_type
WHEN data_sensitivity = 'MEDIUM' THEN 'INTERNAL'::data_classification_type
WHEN data_sensitivity = 'HIGH' THEN 'CONFIDENTIAL'::data_classification_type
WHEN data_sensitivity = 'CRITICAL' THEN 'SECRET'::data_classification_type
END;
ALTER TABLE data
ALTER COLUMN data_classification SET NOT NULL;
ALTER TABLE data
DROP COLUMN data_sensitivity;