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: