From 081678fcacd9719e3bfee1c28d33fdb5b8386a12 Mon Sep 17 00:00:00 2001 From: Tom Zhao <tom.zhao@dsv.su.se> Date: Wed, 6 Nov 2024 11:52:59 +0100 Subject: [PATCH] task/3382: Add back unique key to table idea and fix 'on delete set null' to peer_request and activity_template --- .../db/migration/V390__harmonize_table_attribute_name.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql b/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql index 77136f8df6..ef809dd844 100644 --- a/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql +++ b/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql @@ -1040,7 +1040,7 @@ alter table `activity_template` rename column `checkListTemplate_id` to `checkli alter table `activity_template` add constraint fk_activity_template_checklist_template_id foreign key (checklist_template_id) references checklist_template (id) - on delete cascade on update cascade; + on delete set null on update cascade; -- table: ActivityPlanTemplate (at this stage, no any foreign key is referenced to ActivityPlanTemplate) @@ -1648,6 +1648,8 @@ alter table `idea` change `interests` `interests` longtext default null after `m alter table `idea` rename column `creator_id` to `creator_user_id`; alter table `idea` rename column `match_id` to `latest_match_id`; +alter table `idea` add constraint uk_idea_project_id unique(project_id); + alter table `idea` add constraint fk_idea_creator_user_id foreign key (creator_user_id) references user (id) @@ -1932,7 +1934,7 @@ alter table `peer_request` change `file_reference_id` `file_reference_id` bigint alter table `peer_request` add constraint fk_peer_request_checklist_template_id foreign key (checklist_template_id) references checklist_template (id) - on delete cascade on update cascade; + on delete set null on update cascade; alter table `peer_request` add constraint fk_peer_request_file_reference_id