From 1582f9b96b916cd33998ef78d6be6cc035be83ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=EC=98=81=EB=AF=BC=20=28YeongMin=20Song=29?= Date: Wed, 29 May 2024 08:52:06 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Flyway=20=EB=A7=88=EC=9D=B4=EA=B7=B8?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=85=98=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80=20(#53)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: JPA & DB 프로퍼티 변경 * feat: init DDL 생성 --- .jpb/jpb-settings.xml | 13 +++++++ src/main/resources/V1__init.sql | 54 +++++++++++++++++++++++++++++ src/main/resources/application.yaml | 18 ++++++++++ 3 files changed, 85 insertions(+) create mode 100644 .jpb/jpb-settings.xml create mode 100644 src/main/resources/V1__init.sql diff --git a/.jpb/jpb-settings.xml b/.jpb/jpb-settings.xml new file mode 100644 index 0000000..fd72852 --- /dev/null +++ b/.jpb/jpb-settings.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/V1__init.sql b/src/main/resources/V1__init.sql new file mode 100644 index 0000000..ffac97e --- /dev/null +++ b/src/main/resources/V1__init.sql @@ -0,0 +1,54 @@ +CREATE TABLE attendances +( + id CHAR(26) NOT NULL, + generation INT NOT NULL, + week INT NOT NULL, + member_id CHAR(26) NOT NULL, + session_type VARCHAR(255) NOT NULL, + attendance_status VARCHAR(255) NOT NULL, + attendance_time datetime NULL, + CONSTRAINT pk_attendances PRIMARY KEY (id) +); + +CREATE TABLE member +( + id CHAR(26) NOT NULL, + name VARCHAR(255) NOT NULL, + email VARCHAR(255) NOT NULL, + passcord VARCHAR(255) NULL, + CONSTRAINT pk_member PRIMARY KEY (id) +); + +CREATE TABLE member_generation +( + member_id CHAR(26) NOT NULL, + generation_id INT NOT NULL, + group_id INT NULL, + `role` VARCHAR(255) NOT NULL, + position VARCHAR(255) NOT NULL, + CONSTRAINT pk_member_generation PRIMARY KEY (member_id, generation_id) +); + +CREATE TABLE session +( + id CHAR(26) NOT NULL, + generation INT NOT NULL, + week INT NOT NULL, + title VARCHAR(255) NOT NULL, + `description` VARCHAR(255) NOT NULL, + start_time datetime NOT NULL, + session_type VARCHAR(255) NOT NULL, + address VARCHAR(255) NULL, + longitude DOUBLE NULL, + latitude DOUBLE NULL, + CONSTRAINT pk_session PRIMARY KEY (id) +); + +ALTER TABLE member + ADD CONSTRAINT uc_member_email UNIQUE (email); + +ALTER TABLE attendances + ADD CONSTRAINT FK_ATTENDANCES_ON_MEMBER FOREIGN KEY (member_id) REFERENCES member (id); + +ALTER TABLE member_generation + ADD CONSTRAINT FK_MEMBER_GENERATION_ON_MEMBER FOREIGN KEY (member_id) REFERENCES member (id); diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 1d8bae4..ca7e4b9 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,13 +1,31 @@ spring: + jpa: + hibernate: + ddl-auto: validate + show-sql: false application: name: depromeet-makers-be flyway: enabled: true baseline-on-migrate: true datasource: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver url: ${MYSQL_URL} username: ${MYSQL_USERNAME} password: ${MYSQL_PASSWORD} + hikari: + auto-commit: false + pool-name: makers-db-pool + minimum-idle: 10 + maximum-pool-size: 30 + connection-timeout: 60000 + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 250 + prepStmtCacheSqlLimit: 2048 + useServerPrepStmts: true + server: shutdown: graceful tomcat: