From 0509d60fd475aff9f719a070627f904166915d10 Mon Sep 17 00:00:00 2001 From: Wibaek Park Date: Sat, 21 Dec 2024 23:17:10 +0900 Subject: [PATCH 1/9] =?UTF-8?q?chore:=20flyway=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 5157e8f6..fab6900e 100644 --- a/build.gradle +++ b/build.gradle @@ -53,6 +53,8 @@ dependencies {//todo: 안쓰는 의존성이나 deprecated된 의존성 제거 'jakarta.persistence:jakarta.persistence-api:3.1.0', 'jakarta.annotation:jakarta.annotation-api:2.1.1' ) + + implementation 'org.flywaydb:flyway-core' } tasks.named('test') { From 6745c2951b796faf261dce375bca2a9204493dca Mon Sep 17 00:00:00 2001 From: Wibaek Park Date: Sat, 21 Dec 2024 23:32:51 +0900 Subject: [PATCH 2/9] =?UTF-8?q?chore:=20v2=20=EB=A7=88=EC=9D=B4=EA=B7=B8?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=85=98=20=ED=8C=8C=EC=9D=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - gpa_score, language_test_score 테이블 추가 - 이름이 맞지 않는 FK 이름 수정 - 누락되었던 FK 추가 - application.is_delete 추가 --- ..._add_gpa_score_and_language_test_score.sql | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql diff --git a/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql b/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql new file mode 100644 index 00000000..a938724e --- /dev/null +++ b/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql @@ -0,0 +1,95 @@ +create table gpa_score ( + gpa float(53) not null, + gpa_criteria float(53) not null, + issue_date date, + created_at datetime(6), + id bigint not null auto_increment, + site_user_id bigint, + updated_at datetime(6), + gpa_report_url varchar(500) not null, + rejected_reason varchar(255), + verify_status varchar(50) not null default 'PENDING', + primary key (id) +) engine=InnoDB; + +alter table gpa_score + add constraint FK2k65qncfxvol5j4l4hb7d6iv1 + foreign key (site_user_id) + references site_user (id); + +create table language_test_score ( + issue_date date, + created_at datetime(6), + id bigint not null auto_increment, + site_user_id bigint, + updated_at datetime(6), + language_test_type enum ('CEFR', 'DALF', 'DELF', 'DUOLINGO', 'IELTS', 'JLPT', 'NEW_HSK', 'TCF', 'TEF', 'TOEFL_IBT', 'TOEFL_ITP', 'TOEIC') not null, + language_test_report_url varchar(500) not null, + language_test_score varchar(255) not null, + rejected_reason varchar(255), + verify_status varchar(50) not null default 'PENDING', + primary key (id) +) engine=InnoDB; + +alter table language_test_score + add constraint FKt2uevj2r4iuxumblj5ofbgmqn + foreign key (site_user_id) + references site_user (id); + +alter table application add column is_delete bit; + +alter table application drop foreign key fk_university_info_for_apply_id_1; +alter table application drop foreign key fk_university_info_for_apply_id_2; + +alter table application + add constraint FKi822ljuirbu9o0lnd9jt7l7qg + foreign key (first_choice_university_id) + references university_info_for_apply (id); + +alter table application + add constraint FKepp2by7frnkt1o1w3v4t4lgtu + foreign key (second_choice_university_id) + references university_info_for_apply (id); + +alter table application + add constraint FKeajojvwgn069mfxhbq5ja1sws + foreign key (third_choice_university_id) + references university_info_for_apply (id); + +alter table comment + add constraint FKde3rfu96lep00br5ov0mdieyt + foreign key (parent_id) + references comment (id); + +alter table comment + add constraint FKs1slvnkuemjsq2kj4h3vhx7i1 + foreign key (post_id) + references post (id); + +alter table liked_university drop foreign key FKhj3gn3mqmfeiiw9jt83g7t3rk_idx; +alter table liked_university drop foreign key FKrrhud921brslcukx6fyuh0th3; + +alter table liked_university + add constraint FKkuqxb64dnfrl7har8t5ionw83 + foreign key (site_user_id) + references site_user (id); + +alter table liked_university + add constraint FKo317gq6apc3a091w32qhidtjt + foreign key (university_info_for_apply_id) + references university_info_for_apply (id); + +alter table post + add constraint FKlpnkhhbfb3gg3tfreh2a7qh8b + foreign key (board_code) + references board (code); + +alter table post_image + add constraint FKsip7qv57jw2fw50g97t16nrjr + foreign key (post_id) + references post (id); + +alter table post_like + add constraint FKj7iy0k7n3d0vkh8o7ibjna884 + foreign key (post_id) + references post (id); \ No newline at end of file From c79086e26cee0c60472b6fb164327baddaeb0813 Mon Sep 17 00:00:00 2001 From: Wibaek Park Date: Sun, 22 Dec 2024 04:52:04 +0900 Subject: [PATCH 3/9] =?UTF-8?q?chore:=20flyway=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/secret | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/secret b/src/main/resources/secret index 5c716274..f07f51a3 160000 --- a/src/main/resources/secret +++ b/src/main/resources/secret @@ -1 +1 @@ -Subproject commit 5c716274e096bd349d71d3ced1644bfb08ad0912 +Subproject commit f07f51a36149c1cc147c3c2b5d4832d0b5865be7 From fa1a387c6af6d9fd1abebad149f8fa63a7133266 Mon Sep 17 00:00:00 2001 From: Wibaek Park Date: Sun, 22 Dec 2024 20:30:31 +0900 Subject: [PATCH 4/9] =?UTF-8?q?fix:=20=EC=98=A4=EB=A5=98=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/secret | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/secret b/src/main/resources/secret index f07f51a3..b4f88d14 160000 --- a/src/main/resources/secret +++ b/src/main/resources/secret @@ -1 +1 @@ -Subproject commit f07f51a36149c1cc147c3c2b5d4832d0b5865be7 +Subproject commit b4f88d14185e2009e0793dfd16d22c2c3b9257ae From 20f67a59d9e8de1ca40bd4ce0c100d5104989b3e Mon Sep 17 00:00:00 2001 From: Wibaek Park Date: Sun, 22 Dec 2024 20:30:41 +0900 Subject: [PATCH 5/9] =?UTF-8?q?chore:=20flyway-mysql=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index fab6900e..ceba38c4 100644 --- a/build.gradle +++ b/build.gradle @@ -55,6 +55,7 @@ dependencies {//todo: 안쓰는 의존성이나 deprecated된 의존성 제거 ) implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-mysql' } tasks.named('test') { From d1876b65f67da2cc55343c722cd120ba3fee07a7 Mon Sep 17 00:00:00 2001 From: Wibaek Park Date: Sun, 22 Dec 2024 20:31:38 +0900 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20=EB=A7=88=EC=9D=B4=EA=B7=B8=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20sql=EC=97=90=EC=84=9C=20FK=20=EB=AA=85=20?= =?UTF-8?q?=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95,=20=ED=98=84=EC=9E=AC?= =?UTF-8?q?=20=EC=A1=B4=EC=9E=AC=ED=95=98=EB=8A=94=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=A0=95=ED=95=A9=EC=84=B1=EA=B3=BC=20=EB=A7=9E?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EC=9D=80=20=EC=BF=BC=EB=A6=AC=20=ED=95=98?= =?UTF-8?q?=EB=82=98=20=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../V2__add_gpa_score_and_language_test_score.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql b/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql index a938724e..fefaa3c9 100644 --- a/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql +++ b/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql @@ -66,7 +66,7 @@ alter table comment foreign key (post_id) references post (id); -alter table liked_university drop foreign key FKhj3gn3mqmfeiiw9jt83g7t3rk_idx; +alter table liked_university drop foreign key FKhj3gn3mqmfeiiw9jt83g7t3rk; alter table liked_university drop foreign key FKrrhud921brslcukx6fyuh0th3; alter table liked_university @@ -84,10 +84,10 @@ alter table post foreign key (board_code) references board (code); -alter table post_image - add constraint FKsip7qv57jw2fw50g97t16nrjr - foreign key (post_id) - references post (id); +-- alter table post_image +-- add constraint FKsip7qv57jw2fw50g97t16nrjr +-- foreign key (post_id) +-- references post (id); alter table post_like add constraint FKj7iy0k7n3d0vkh8o7ibjna884 From 3c1316ff1936b4777a961334b9df3c00df957219 Mon Sep 17 00:00:00 2001 From: Wibaek Park <34394229+wibaek@users.noreply.github.com> Date: Sat, 28 Dec 2024 13:37:35 +0000 Subject: [PATCH 7/9] =?UTF-8?q?style:=20=ED=8C=8C=EC=9D=BC=20=EB=A7=88?= =?UTF-8?q?=EC=A7=80=EB=A7=89=EC=A4=84=20=EA=B0=9C=ED=96=89=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/V2__add_gpa_score_and_language_test_score.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql b/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql index fefaa3c9..ad3ab10b 100644 --- a/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql +++ b/src/main/resources/db/migration/V2__add_gpa_score_and_language_test_score.sql @@ -92,4 +92,4 @@ alter table post alter table post_like add constraint FKj7iy0k7n3d0vkh8o7ibjna884 foreign key (post_id) - references post (id); \ No newline at end of file + references post (id); From cca31404ccd369472587909f8aa3be2980533383 Mon Sep 17 00:00:00 2001 From: Wibaek Park Date: Wed, 1 Jan 2025 01:01:38 +0900 Subject: [PATCH 8/9] =?UTF-8?q?chore:=20V1=5F=5Finit.sql=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/db/migration/V1__init.sql | 259 +++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 src/main/resources/db/migration/V1__init.sql diff --git a/src/main/resources/db/migration/V1__init.sql b/src/main/resources/db/migration/V1__init.sql new file mode 100644 index 00000000..e3f92025 --- /dev/null +++ b/src/main/resources/db/migration/V1__init.sql @@ -0,0 +1,259 @@ +CREATE TABLE IF NOT EXISTS application +( + id BIGINT AUTO_INCREMENT NOT NULL, + term VARCHAR(50) NOT NULL, + site_user_id BIGINT NULL, + nickname_for_apply VARCHAR(100) NULL, + update_count INT DEFAULT 0 NOT NULL, + verify_status VARCHAR(50) DEFAULT 'PENDING' NOT NULL, + gpa DOUBLE NOT NULL, + gpa_criteria DOUBLE NOT NULL, + language_test_type ENUM NOT NULL, + language_test_score VARCHAR(255) NOT NULL, + gpa_report_url VARCHAR(500) NOT NULL, + language_test_report_url VARCHAR(500) NOT NULL, + first_choice_university_id BIGINT NULL, + second_choice_university_id BIGINT NULL, + third_choice_university_id BIGINT NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS board +( + code VARCHAR(20) NOT NULL, + korean_name VARCHAR(20) NOT NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (code) +); + +CREATE TABLE IF NOT EXISTS comment +( + created_at datetime NULL, + id BIGINT AUTO_INCREMENT NOT NULL, + parent_id BIGINT NULL, + post_id BIGINT NULL, + site_user_id BIGINT NULL, + updated_at datetime NULL, + content VARCHAR(255) NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS country +( + code VARCHAR(2) NOT NULL, + region_code VARCHAR(10) NULL, + korean_name VARCHAR(100) NOT NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (code) +); + +CREATE TABLE IF NOT EXISTS interested_country +( + country_code VARCHAR(2) NULL, + id BIGINT AUTO_INCREMENT NOT NULL, + site_user_id BIGINT NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS interested_region +( + id BIGINT AUTO_INCREMENT NOT NULL, + site_user_id BIGINT NULL, + region_code VARCHAR(10) NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS language_requirement +( + id BIGINT AUTO_INCREMENT NOT NULL, + university_info_for_apply_id BIGINT NULL, + language_test_type ENUM NOT NULL, + min_score VARCHAR(255) NOT NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS liked_university +( + id BIGINT AUTO_INCREMENT NOT NULL, + site_user_id BIGINT NULL, + university_info_for_apply_id BIGINT NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS post +( + is_question BIT(1) NULL, + created_at datetime NULL, + id BIGINT AUTO_INCREMENT NOT NULL, + like_count BIGINT NULL, + site_user_id BIGINT NULL, + updated_at datetime NULL, + view_count BIGINT NULL, + board_code VARCHAR(20) NULL, + content VARCHAR(1000) NULL, + category ENUM NULL, + title VARCHAR(255) NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS post_image +( + id BIGINT AUTO_INCREMENT NOT NULL, + post_id BIGINT NULL, + url VARCHAR(500) NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS post_like +( + id BIGINT AUTO_INCREMENT NOT NULL, + post_id BIGINT NULL, + site_user_id BIGINT NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS region +( + code VARCHAR(10) NOT NULL, + korean_name VARCHAR(100) NOT NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (code) +); + +CREATE TABLE IF NOT EXISTS site_user +( + quited_at date NULL, + id BIGINT AUTO_INCREMENT NOT NULL, + nickname_modified_at datetime NULL, + birth VARCHAR(20) NOT NULL, + email VARCHAR(100) NOT NULL, + nickname VARCHAR(100) NOT NULL, + profile_image_url VARCHAR(500) NULL, + gender ENUM NOT NULL, + preparation_stage ENUM NOT NULL, + `role` ENUM NOT NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS university +( + id BIGINT AUTO_INCREMENT NOT NULL, + region_code VARCHAR(10) NULL, + country_code VARCHAR(2) NULL, + format_name VARCHAR(100) NOT NULL, + english_name VARCHAR(100) NOT NULL, + korean_name VARCHAR(100) NOT NULL, + background_image_url VARCHAR(500) NOT NULL, + logo_image_url VARCHAR(500) NOT NULL, + details_for_local VARCHAR(1000) NULL, + homepage_url VARCHAR(500) NULL, + english_course_url VARCHAR(500) NULL, + accommodation_url VARCHAR(500) NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +CREATE TABLE IF NOT EXISTS university_info_for_apply +( + id BIGINT AUTO_INCREMENT NOT NULL, + term VARCHAR(50) NOT NULL, + university_id BIGINT NULL, + korean_name VARCHAR(100) NOT NULL, + student_capacity INT NULL, + tuition_fee_type ENUM NULL, + semester_available_for_dispatch ENUM NULL, + details_for_language VARCHAR(1000) NULL, + gpa_requirement VARCHAR(100) NULL, + gpa_requirement_criteria VARCHAR(100) NULL, + semester_requirement VARCHAR(100) NULL, + details_for_apply VARCHAR(1000) NULL, + details_for_major VARCHAR(1000) NULL, + details_for_english_course VARCHAR(1000) NULL, + details_for_accommodation VARCHAR(1000) NULL, + details VARCHAR(500) NULL, + CONSTRAINT `PRIMARY` PRIMARY KEY (id) +); + +ALTER TABLE site_user + ADD CONSTRAINT site_user_email_unique UNIQUE (email); + +ALTER TABLE comment + ADD CONSTRAINT FK11tfff2an5hdv747cktxbdi6t FOREIGN KEY (site_user_id) REFERENCES site_user (id) ON DELETE NO ACTION; + +CREATE INDEX FK11tfff2an5hdv747cktxbdi6t ON comment (site_user_id); + +ALTER TABLE interested_country + ADD CONSTRAINT FK26u5am55jefclcd7r5smk8ai7 FOREIGN KEY (site_user_id) REFERENCES site_user (id) ON DELETE NO ACTION; + +CREATE INDEX FK26u5am55jefclcd7r5smk8ai7 ON interested_country (site_user_id); + +ALTER TABLE interested_region + ADD CONSTRAINT FK7h2182pqkavi9d8o2pku6gidi FOREIGN KEY (region_code) REFERENCES region (code) ON DELETE NO ACTION; + +CREATE INDEX FK7h2182pqkavi9d8o2pku6gidi ON interested_region (region_code); + +ALTER TABLE interested_country + ADD CONSTRAINT FK7x4ad24lblkq2ss0920uqfd6s FOREIGN KEY (country_code) REFERENCES country (code) ON DELETE NO ACTION; + +CREATE INDEX FK7x4ad24lblkq2ss0920uqfd6s ON interested_country (country_code); + +ALTER TABLE university_info_for_apply + ADD CONSTRAINT FKd0257hco6uy2utd1xccjh3fal FOREIGN KEY (university_id) REFERENCES university (id) ON DELETE NO ACTION; + +CREATE INDEX FKd0257hco6uy2utd1xccjh3fal ON university_info_for_apply (university_id); + +ALTER TABLE post + ADD CONSTRAINT FKfu9q9o3mlqkd58wg45ykgu8ni FOREIGN KEY (site_user_id) REFERENCES site_user (id) ON DELETE NO ACTION; + +CREATE INDEX FKfu9q9o3mlqkd58wg45ykgu8ni ON post (site_user_id); + +ALTER TABLE post_like + ADD CONSTRAINT FKgx1v0whinnoqveopoh6tb4ykb FOREIGN KEY (site_user_id) REFERENCES site_user (id) ON DELETE NO ACTION; + +CREATE INDEX FKgx1v0whinnoqveopoh6tb4ykb ON post_like (site_user_id); + +ALTER TABLE liked_university + ADD CONSTRAINT FKhj3gn3mqmfeiiw9jt83g7t3rk FOREIGN KEY (university_info_for_apply_id) REFERENCES university_info_for_apply (id) ON DELETE NO ACTION; + +CREATE INDEX FKhj3gn3mqmfeiiw9jt83g7t3rk_idx ON liked_university (university_info_for_apply_id); + +ALTER TABLE interested_region + ADD CONSTRAINT FKia6h0pbisqhgm3lkeya6vqo4w FOREIGN KEY (site_user_id) REFERENCES site_user (id) ON DELETE NO ACTION; + +CREATE INDEX FKia6h0pbisqhgm3lkeya6vqo4w ON interested_region (site_user_id); + +ALTER TABLE country + ADD CONSTRAINT FKife035f2scmgcutdtv6bfd6g8 FOREIGN KEY (region_code) REFERENCES region (code) ON DELETE NO ACTION; + +CREATE INDEX FKife035f2scmgcutdtv6bfd6g8 ON country (region_code); + +ALTER TABLE university + ADD CONSTRAINT FKksoyt17h0te1ra588y4a3208r FOREIGN KEY (country_code) REFERENCES country (code) ON DELETE NO ACTION; + +CREATE INDEX FKksoyt17h0te1ra588y4a3208r ON university (country_code); + +ALTER TABLE university + ADD CONSTRAINT FKpwr8ocev54r8d22wdyj4a37bc FOREIGN KEY (region_code) REFERENCES region (code) ON DELETE NO ACTION; + +CREATE INDEX FKpwr8ocev54r8d22wdyj4a37bc ON university (region_code); + +ALTER TABLE language_requirement + ADD CONSTRAINT FKr75pgslwfbrvjkfau6dwtlg8l FOREIGN KEY (university_info_for_apply_id) REFERENCES university_info_for_apply (id) ON DELETE NO ACTION; + +CREATE INDEX FKr75pgslwfbrvjkfau6dwtlg8l ON language_requirement (university_info_for_apply_id); + +ALTER TABLE liked_university + ADD CONSTRAINT FKrrhud921brslcukx6fyuh0th3 FOREIGN KEY (site_user_id) REFERENCES site_user (id) ON DELETE NO ACTION; + +CREATE INDEX FKrrhud921brslcukx6fyuh0th3 ON liked_university (site_user_id); + +ALTER TABLE application + ADD CONSTRAINT FKs4s3hebtn7vwd0b4xt8msxsis FOREIGN KEY (site_user_id) REFERENCES site_user (id) ON DELETE NO ACTION; + +CREATE INDEX FKs4s3hebtn7vwd0b4xt8msxsis ON application (site_user_id); + +ALTER TABLE application + ADD CONSTRAINT fk_university_info_for_apply_id_1 FOREIGN KEY (first_choice_university_id) REFERENCES university_info_for_apply (id) ON DELETE NO ACTION; + +CREATE INDEX fk_university_info_for_apply_id_1 ON application (first_choice_university_id); + +ALTER TABLE application + ADD CONSTRAINT fk_university_info_for_apply_id_2 FOREIGN KEY (second_choice_university_id) REFERENCES university_info_for_apply (id) ON DELETE NO ACTION; + +CREATE INDEX fk_university_info_for_apply_id_2 ON application (second_choice_university_id); \ No newline at end of file From 0cb78a800f87d168aa09640852d8f5b6ef722870 Mon Sep 17 00:00:00 2001 From: Wibaek Park Date: Sun, 5 Jan 2025 05:10:47 +0900 Subject: [PATCH 9/9] =?UTF-8?q?fix:=20enum=20=EB=88=84=EB=9D=BD=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/db/migration/V1__init.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/resources/db/migration/V1__init.sql b/src/main/resources/db/migration/V1__init.sql index e3f92025..8910ad62 100644 --- a/src/main/resources/db/migration/V1__init.sql +++ b/src/main/resources/db/migration/V1__init.sql @@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS application verify_status VARCHAR(50) DEFAULT 'PENDING' NOT NULL, gpa DOUBLE NOT NULL, gpa_criteria DOUBLE NOT NULL, - language_test_type ENUM NOT NULL, + language_test_type ENUM ('CEFR','DALF','DELF','DUOLINGO','IELTS','JLPT','NEW_HSK','TCF','TEF','TOEFL_IBT','TOEFL_ITP','TOEIC') NOT NULL, language_test_score VARCHAR(255) NOT NULL, gpa_report_url VARCHAR(500) NOT NULL, language_test_report_url VARCHAR(500) NOT NULL, @@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS language_requirement ( id BIGINT AUTO_INCREMENT NOT NULL, university_info_for_apply_id BIGINT NULL, - language_test_type ENUM NOT NULL, + language_test_type ENUM ('CEFR','DALF','DELF','DUOLINGO','IELTS','JLPT','NEW_HSK','TCF','TEF','TOEFL_IBT','TOEFL_ITP','TOEIC') NOT NULL, min_score VARCHAR(255) NOT NULL, CONSTRAINT `PRIMARY` PRIMARY KEY (id) ); @@ -89,7 +89,7 @@ CREATE TABLE IF NOT EXISTS post view_count BIGINT NULL, board_code VARCHAR(20) NULL, content VARCHAR(1000) NULL, - category ENUM NULL, + category ENUM ('자유','전체','질문') NULL, title VARCHAR(255) NULL, CONSTRAINT `PRIMARY` PRIMARY KEY (id) ); @@ -126,9 +126,9 @@ CREATE TABLE IF NOT EXISTS site_user email VARCHAR(100) NOT NULL, nickname VARCHAR(100) NOT NULL, profile_image_url VARCHAR(500) NULL, - gender ENUM NOT NULL, - preparation_stage ENUM NOT NULL, - `role` ENUM NOT NULL, + gender ENUM ('FEMALE','MALE','PREFER_NOT_TO_SAY') NOT NULL, + preparation_stage ENUM ('AFTER_EXCHANGE','CONSIDERING','PREPARING_FOR_DEPARTURE','STUDYING_ABROAD') NOT NULL, + `role` ENUM ('MENTEE','MENTOR') NOT NULL, CONSTRAINT `PRIMARY` PRIMARY KEY (id) ); @@ -156,8 +156,8 @@ CREATE TABLE IF NOT EXISTS university_info_for_apply university_id BIGINT NULL, korean_name VARCHAR(100) NOT NULL, student_capacity INT NULL, - tuition_fee_type ENUM NULL, - semester_available_for_dispatch ENUM NULL, + tuition_fee_type ENUM ('HOME_UNIVERSITY_PAYMENT','MIXED_PAYMENT','OVERSEAS_UNIVERSITY_PAYMENT') NULL, + semester_available_for_dispatch ENUM ('FOUR_SEMESTER','IRRELEVANT','NO_DATA','ONE_OR_TWO_SEMESTER','ONE_SEMESTER','ONE_YEAR') NULL, details_for_language VARCHAR(1000) NULL, gpa_requirement VARCHAR(100) NULL, gpa_requirement_criteria VARCHAR(100) NULL,