diff --git a/postgresql/update/W2025-16.sql b/postgresql/update/W2025-16.sql new file mode 100644 index 0000000000..26403f6fa1 --- /dev/null +++ b/postgresql/update/W2025-16.sql @@ -0,0 +1,13 @@ + +-- Add unique constraint +ALTER TABLE item_type_mapping +ADD CONSTRAINT uq_item_type_mapping_item_type_id UNIQUE (item_type_id); + +-- Add foreign key constraint +ALTER TABLE item_type_mapping +ADD CONSTRAINT fk_item_type_mapping_item_type_id_item_type +FOREIGN KEY (item_type_id) REFERENCES item_type(id) ON DELETE CASCADE; + +-- Drop indexes +DROP INDEX IF EXISTS idx_created_item_type_mapping; +DROP INDEX IF EXISTS idx_item_type_id_item_type_mapping;