From 189b33cea6660c9477240c3e5881135cbc923cf2 Mon Sep 17 00:00:00 2001 From: ivis-miyachi Date: Fri, 26 Jun 2026 18:46:18 +0900 Subject: [PATCH] Create SQL migration for item_type_mapping constraints(#61275) --- postgresql/update/W2025-16.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 postgresql/update/W2025-16.sql 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;