From 254b29917ffa526df10827d7a497ee52eefc8f54 Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Fri, 19 Jul 2024 19:22:43 +0900 Subject: [PATCH] =?UTF-8?q?[#159/refactor]=20=EB=B3=B5=ED=95=A9=EC=9D=B8?= =?UTF-8?q?=EB=8D=B1=EC=8A=A4=20=EC=88=9C=EC=84=9C=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?(#217)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 복합인덱스 순서 변경 * fix: jooqCodegen이 h2를 사용하여 자동 생성된 unique 조건을 인식하지 못하는 문제 해결 * refactor: 기존 하나의 파일을 분리 --- .../entity/V1.00.0.10__drop_subscription_unique_key.sql | 8 ++++++++ .../entity/V1.00.0.11__add_mapping_member_workbook_pk.sql | 3 +++ .../V1.00.0.12__add_mapping_workbook_article_pk.sql | 3 +++ .../entity/V1.00.0.13__add_subscription_unique_key.sql | 6 ++++++ .../entity/V1.00.0.8__drop_mapping_member_workbook_pk.sql | 3 +++ .../V1.00.0.9__drop_mapping_workbook_article_pk.sql | 3 +++ 6 files changed, 26 insertions(+) create mode 100644 data/db/migration/entity/V1.00.0.10__drop_subscription_unique_key.sql create mode 100644 data/db/migration/entity/V1.00.0.11__add_mapping_member_workbook_pk.sql create mode 100644 data/db/migration/entity/V1.00.0.12__add_mapping_workbook_article_pk.sql create mode 100644 data/db/migration/entity/V1.00.0.13__add_subscription_unique_key.sql create mode 100644 data/db/migration/entity/V1.00.0.8__drop_mapping_member_workbook_pk.sql create mode 100644 data/db/migration/entity/V1.00.0.9__drop_mapping_workbook_article_pk.sql diff --git a/data/db/migration/entity/V1.00.0.10__drop_subscription_unique_key.sql b/data/db/migration/entity/V1.00.0.10__drop_subscription_unique_key.sql new file mode 100644 index 000000000..ebba1977c --- /dev/null +++ b/data/db/migration/entity/V1.00.0.10__drop_subscription_unique_key.sql @@ -0,0 +1,8 @@ +-- SUBSCRIPTION 테이블의 target_member_id, target_workbook_id 컬럼에 대한 유니크 키 제약을 제거합니다. +-- 해당 제약 조건 제거의 경우 직접 SQL을 작성하여 제거합니다. + +-- ALTER TABLE SUBSCRIPTION +-- DROP KEY target_member_id; +-- +-- ALTER TABLE SUBSCRIPTION +-- DROP KEY target_workbook_id; diff --git a/data/db/migration/entity/V1.00.0.11__add_mapping_member_workbook_pk.sql b/data/db/migration/entity/V1.00.0.11__add_mapping_member_workbook_pk.sql new file mode 100644 index 000000000..eee9f9046 --- /dev/null +++ b/data/db/migration/entity/V1.00.0.11__add_mapping_member_workbook_pk.sql @@ -0,0 +1,3 @@ +-- MAPPING_MEMBER_WORKBOOK 테이블의 기본키 제약 조건을 추가합니다. +ALTER TABLE MAPPING_MEMBER_WORKBOOK + ADD CONSTRAINT mapping_member_workbook_pk PRIMARY KEY (member_id, workbook_id); diff --git a/data/db/migration/entity/V1.00.0.12__add_mapping_workbook_article_pk.sql b/data/db/migration/entity/V1.00.0.12__add_mapping_workbook_article_pk.sql new file mode 100644 index 000000000..fab32f9da --- /dev/null +++ b/data/db/migration/entity/V1.00.0.12__add_mapping_workbook_article_pk.sql @@ -0,0 +1,3 @@ +-- MAPPING_WORKBOOK_ARTICLE 테이블의 기본키 제약 조건을 추가합니다. +ALTER TABLE MAPPING_WORKBOOK_ARTICLE + ADD CONSTRAINT mapping_workbook_article_pk PRIMARY KEY (article_id, workbook_id); diff --git a/data/db/migration/entity/V1.00.0.13__add_subscription_unique_key.sql b/data/db/migration/entity/V1.00.0.13__add_subscription_unique_key.sql new file mode 100644 index 000000000..1a4a9b6e0 --- /dev/null +++ b/data/db/migration/entity/V1.00.0.13__add_subscription_unique_key.sql @@ -0,0 +1,6 @@ +-- SUBSCRIPTION 테이블의 유니크 키 제약을 추가합니다. +ALTER TABLE SUBSCRIPTION + ADD CONSTRAINT subscription_unique_member_id_target_member_id UNIQUE (member_id, target_member_id); + +ALTER TABLE SUBSCRIPTION + ADD CONSTRAINT subscription_unique_member_id_target_workbook_id UNIQUE (member_id, target_workbook_id); diff --git a/data/db/migration/entity/V1.00.0.8__drop_mapping_member_workbook_pk.sql b/data/db/migration/entity/V1.00.0.8__drop_mapping_member_workbook_pk.sql new file mode 100644 index 000000000..20acf65c0 --- /dev/null +++ b/data/db/migration/entity/V1.00.0.8__drop_mapping_member_workbook_pk.sql @@ -0,0 +1,3 @@ +-- MAPPING_MEMBER_WORKBOOK 테이블의 기본키 제약 조건을 제거합니다. +ALTER TABLE MAPPING_MEMBER_WORKBOOK + DROP PRIMARY KEY; diff --git a/data/db/migration/entity/V1.00.0.9__drop_mapping_workbook_article_pk.sql b/data/db/migration/entity/V1.00.0.9__drop_mapping_workbook_article_pk.sql new file mode 100644 index 000000000..534a3acbe --- /dev/null +++ b/data/db/migration/entity/V1.00.0.9__drop_mapping_workbook_article_pk.sql @@ -0,0 +1,3 @@ +-- MAPPING_WOKRBOOK_ARTICLE 테이블의 기본키 제약 조건을 제거합니다. +ALTER TABLE MAPPING_WORKBOOK_ARTICLE + DROP PRIMARY KEY;