From 876f35919a288268ce0dc93910ecee7bb35e1242 Mon Sep 17 00:00:00 2001 From: sunwoong Date: Thu, 4 Jan 2024 18:54:53 +0900 Subject: [PATCH 1/4] =?UTF-8?q?chore:=20flyway=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EC=B6=94=EA=B0=80=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doorip-api/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doorip-api/build.gradle b/doorip-api/build.gradle index 6c7cae5..048c55c 100644 --- a/doorip-api/build.gradle +++ b/doorip-api/build.gradle @@ -8,6 +8,8 @@ dependencies { implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5' runtimeOnly 'com.h2database:h2' runtimeOnly 'com.mysql:mysql-connector-j' + implementation "org.flywaydb:flyway-core" + implementation "org.flywaydb:flyway-mysql" implementation project(path: ':doorip-domain') implementation project(path: ':doorip-external') implementation project(path: ':doorip-common') From 8e3d6058c51713a4f0a516952bb26b688adbcddc Mon Sep 17 00:00:00 2001 From: sunwoong Date: Thu, 4 Jan 2024 18:55:39 +0900 Subject: [PATCH 2/4] =?UTF-8?q?docs:=20ddl=20db=20migration=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=B6=94=EA=B0=80=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/db/migration/V1__ddl.sql | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 doorip-api/src/main/resources/db/migration/V1__ddl.sql diff --git a/doorip-api/src/main/resources/db/migration/V1__ddl.sql b/doorip-api/src/main/resources/db/migration/V1__ddl.sql new file mode 100644 index 0000000..f498fa1 --- /dev/null +++ b/doorip-api/src/main/resources/db/migration/V1__ddl.sql @@ -0,0 +1,70 @@ +create table users +( + created_date timestamp(6), + last_modified_date timestamp(6), + user_id bigint auto_increment, + name varchar(255) not null, + intro varchar(255) not null, + result integer, + platform_id varchar(255) not null, + platform varchar(255) check (platform in ('KAKAO', 'APPLE')), + refresh_token varchar(255), + primary key (user_id) +); + +create table trip +( + created_date timestamp(6), + last_modified_date timestamp(6), + trip_id bigint auto_increment, + title varchar(255) not null, + start_date date not null, + end_date date not null, + code varchar(255) not null, + primary key (trip_id) +); + +create table participant +( + created_date timestamp(6), + last_modified_date timestamp(6), + participant_id bigint auto_increment, + user_id bigint unique, + trip_id bigint unique, + role varchar(255) check (role in ('HOST', 'PARTICIPATION')), + style_a integer not null, + style_b integer not null, + style_c integer not null, + style_d integer not null, + style_e integer not null, + primary key (participant_id), + foreign key (user_id) references users (user_id), + foreign key (trip_id) references trip (trip_id) +); + +create table todo +( + created_date timestamp(6), + last_modified_date timestamp(6), + todo_id bigint auto_increment, + trip_id bigint unique, + title varchar(255) not null, + end_date date, + memo varchar(255), + secret varchar(255) check (secret in ('OUR', 'MY')), + progress varchar(255) check (progress in ('INCOMPLETE', 'COMPLETE')), + primary key (todo_id), + foreign key (trip_id) references trip (trip_id) +); + +create table allocator +( + created_date timestamp(6), + last_modified_date timestamp(6), + allocator_id bigint auto_increment, + participant_id bigint unique, + todo_id bigint unique, + primary key (allocator_id), + foreign key (participant_id) references participant (participant_id), + foreign key (todo_id) references todo (todo_id) +); \ No newline at end of file From d32dd640264afc932bcef6185b122f9af48b1eae Mon Sep 17 00:00:00 2001 From: sunwoong Date: Thu, 4 Jan 2024 18:56:08 +0900 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=EB=88=84=EB=9D=BD=EB=90=9C=20?= =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=20=EC=98=B5=EC=85=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/doorip/trip/domain/Participant.java | 10 +++++----- .../src/main/java/org/doorip/trip/domain/Trip.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doorip-domain/src/main/java/org/doorip/trip/domain/Participant.java b/doorip-domain/src/main/java/org/doorip/trip/domain/Participant.java index fd58ae8..6e6c70b 100644 --- a/doorip-domain/src/main/java/org/doorip/trip/domain/Participant.java +++ b/doorip-domain/src/main/java/org/doorip/trip/domain/Participant.java @@ -19,15 +19,15 @@ public class Participant extends BaseTimeEntity { @Column(nullable = false) @Enumerated(EnumType.STRING) private Role role; - @Column(nullable = false) + @Column(nullable = false, name = "style_a") private Integer styleA; - @Column(nullable = false) + @Column(nullable = false, name = "style_b") private Integer styleB; - @Column(nullable = false) + @Column(nullable = false, name = "style_c") private Integer styleC; - @Column(nullable = false) + @Column(nullable = false, name = "style_d") private Integer styleD; - @Column(nullable = false) + @Column(nullable = false, name = "style_e") private Integer styleE; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_id") diff --git a/doorip-domain/src/main/java/org/doorip/trip/domain/Trip.java b/doorip-domain/src/main/java/org/doorip/trip/domain/Trip.java index 265bf39..84139b1 100644 --- a/doorip-domain/src/main/java/org/doorip/trip/domain/Trip.java +++ b/doorip-domain/src/main/java/org/doorip/trip/domain/Trip.java @@ -16,7 +16,7 @@ @Entity public class Trip extends BaseTimeEntity { @Id - @GeneratedValue + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "trip_id") private Long id; @Column(nullable = false) From 457eeee8f6862a3c0a2236e01b03ef671e4a634d Mon Sep 17 00:00:00 2001 From: sunwoong Date: Thu, 4 Jan 2024 19:02:13 +0900 Subject: [PATCH 4/4] =?UTF-8?q?docs:=20ddl=20=EC=A0=95=EB=A0=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doorip-api/src/main/resources/db/migration/V1__ddl.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doorip-api/src/main/resources/db/migration/V1__ddl.sql b/doorip-api/src/main/resources/db/migration/V1__ddl.sql index f498fa1..02f2a4e 100644 --- a/doorip-api/src/main/resources/db/migration/V1__ddl.sql +++ b/doorip-api/src/main/resources/db/migration/V1__ddl.sql @@ -1,7 +1,7 @@ create table users ( created_date timestamp(6), - last_modified_date timestamp(6), + last_modified_date timestamp(6), user_id bigint auto_increment, name varchar(255) not null, intro varchar(255) not null, @@ -15,7 +15,7 @@ create table users create table trip ( created_date timestamp(6), - last_modified_date timestamp(6), + last_modified_date timestamp(6), trip_id bigint auto_increment, title varchar(255) not null, start_date date not null, @@ -27,7 +27,7 @@ create table trip create table participant ( created_date timestamp(6), - last_modified_date timestamp(6), + last_modified_date timestamp(6), participant_id bigint auto_increment, user_id bigint unique, trip_id bigint unique, @@ -45,7 +45,7 @@ create table participant create table todo ( created_date timestamp(6), - last_modified_date timestamp(6), + last_modified_date timestamp(6), todo_id bigint auto_increment, trip_id bigint unique, title varchar(255) not null, @@ -60,7 +60,7 @@ create table todo create table allocator ( created_date timestamp(6), - last_modified_date timestamp(6), + last_modified_date timestamp(6), allocator_id bigint auto_increment, participant_id bigint unique, todo_id bigint unique,