From 11fd345d5eba45b1936db9d2da5fee2025b249dc Mon Sep 17 00:00:00 2001 From: pricelees Date: Sun, 7 Sep 2025 22:07:21 +0900 Subject: [PATCH] =?UTF-8?q?remove:=20=EC=9D=B4=EC=A0=84=20=EC=8A=A4?= =?UTF-8?q?=ED=82=A4=EB=A7=88=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/schema/schema-h2.sql | 67 ++-------------- src/main/resources/schema/schema-mysql.sql | 92 ++++++++-------------- 2 files changed, 36 insertions(+), 123 deletions(-) diff --git a/src/main/resources/schema/schema-h2.sql b/src/main/resources/schema/schema-h2.sql index 59f38c5e..64c1439d 100644 --- a/src/main/resources/schema/schema-h2.sql +++ b/src/main/resources/schema/schema-h2.sql @@ -18,15 +18,6 @@ create table if not exists members ( last_modified_at timestamp ); -create table if not exists themes ( - theme_id bigint primary key, - description varchar(255) not null, - name varchar(255) not null, - thumbnail varchar(255) not null, - created_at timestamp, - last_modified_at timestamp -); - create table if not exists theme ( id bigint primary key , name varchar(30) not null, @@ -66,28 +57,6 @@ create table if not exists schedule ( constraint fk_schedule__theme_id foreign key (theme_id) references theme (id) ); -create table if not exists times ( - time_id bigint primary key, - start_at time not null, - created_at timestamp null, - last_modified_at timestamp null -); - -create table if not exists reservations ( - reservation_id bigint primary key, - date date not null, - member_id bigint not null, - theme_id bigint not null, - time_id bigint not null, - status varchar(30) not null, - created_at timestamp, - last_modified_at timestamp, - - constraint fk_reservations__themeId foreign key (theme_id) references themes (theme_id), - constraint fk_reservations__memberId foreign key (member_id) references members (member_id), - constraint fk_reservations__timeId foreign key (time_id) references times (time_id) -); - create table if not exists reservation ( id bigint primary key, member_id bigint not null, @@ -119,33 +88,7 @@ create table if not exists canceled_reservation ( constraint fk_canceled_reservations__canceled_by foreign key (canceled_by) references members (member_id) ); -create table if not exists payments ( - payment_id bigint primary key, - approved_at timestamp not null, - reservation_id bigint not null, - total_amount bigint not null, - order_id varchar(255) not null, - payment_key varchar(255) not null, - created_at timestamp, - last_modified_at timestamp, - - constraint uk_payments__reservationId unique (reservation_id), - constraint fk_payments__reservationId foreign key (reservation_id) references reservations (reservation_id) -); - -create table if not exists canceled_payments ( - canceled_payment_id bigint primary key, - payment_key varchar(255) not null, - cancel_reason varchar(255) not null, - cancel_amount bigint not null, - approved_at timestamp not null, - canceled_at timestamp not null, - - created_at timestamp, - last_modified_at timestamp -); - -create table if not exists payment1 ( +create table if not exists payment ( id bigint primary key, reservation_id bigint not null, type varchar(20) not null, @@ -167,7 +110,7 @@ create table if not exists payment_detail( supplied_amount integer not null, vat integer not null, - constraint fk_payment_detail__paymentId foreign key (payment_id) references payment1 (id) + constraint fk_payment_detail__paymentId foreign key (payment_id) references payment (id) ); create table if not exists payment_bank_transfer_detail ( @@ -203,7 +146,7 @@ create table if not exists payment_easypay_prepaid_detail( constraint fk_payment_easypay_prepaid_detail__id foreign key (id) references payment_detail (id) ); -create table if not exists canceled_payment1( +create table if not exists canceled_payment( id bigint primary key, payment_id bigint not null, requested_at timestamp not null, @@ -215,7 +158,7 @@ create table if not exists canceled_payment1( transfer_discount_amount integer not null, easypay_discount_amount integer not null, - constraint uk_canceled_payment1__paymentId unique (payment_id), - constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment1(id), + constraint uk_canceled_payment__paymentId unique (payment_id), + constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment(id), constraint fk_canceled_payment__canceledBy foreign key (canceled_by) references members(member_id) ); diff --git a/src/main/resources/schema/schema-mysql.sql b/src/main/resources/schema/schema-mysql.sql index 6e78453e..cae84864 100644 --- a/src/main/resources/schema/schema-mysql.sql +++ b/src/main/resources/schema/schema-mysql.sql @@ -19,16 +19,6 @@ create table if not exists members last_modified_at datetime(6) null ); -create table if not exists themes -( - theme_id bigint primary key, - description varchar(255) not null, - name varchar(255) not null, - thumbnail varchar(255) not null, - created_at datetime(6) null, - last_modified_at datetime(6) null -); - create table if not exists theme ( id bigint primary key , name varchar(30) not null, @@ -68,57 +58,37 @@ create table if not exists schedule ( constraint fk_schedule__theme_id foreign key (theme_id) references theme (id) ); -create table if not exists times -( - time_id bigint primary key, - start_at time(6) not null, - created_at datetime(6) null, - last_modified_at datetime(6) null +create table if not exists reservation ( + id bigint primary key, + member_id bigint not null, + schedule_id bigint not null, + reserver_name varchar(30) not null, + reserver_contact varchar(30) not null, + participant_count smallint not null, + requirement varchar(255) not null, + status varchar(30) not null, + created_at datetime(6) not null, + created_by bigint not null, + updated_at datetime(6) not null, + updated_by bigint not null, + + constraint fk_reservation__member_id foreign key (member_id) references members (member_id), + constraint fk_reservation__schedule_id foreign key (schedule_id) references schedule (id) ); -create table if not exists reservations -( - reservation_id bigint primary key, - date date not null, - member_id bigint not null, - theme_id bigint not null, - time_id bigint not null, - status varchar(30) not null, - created_at datetime(6) null, - last_modified_at datetime(6) null, - constraint fk_reservations__themeId foreign key (theme_id) references themes (theme_id), - constraint fk_reservations__memberId foreign key (member_id) references members (member_id), - constraint fk_reservations__timeId foreign key (time_id) references times (time_id) +create table if not exists canceled_reservation ( + id bigint primary key, + reservation_id bigint not null, + canceled_by bigint not null, + cancel_reason varchar(50) not null, + canceled_at datetime(6) not null, + status varchar(30) not null, + constraint uk_canceled_reservations__reservation_id unique (reservation_id), + constraint fk_canceled_reservations__reservation_id foreign key (reservation_id) references reservation (id), + constraint fk_canceled_reservations__canceled_by foreign key (canceled_by) references members (member_id) ); -create table if not exists payments -( - payment_id bigint primary key, - approved_at datetime(6) not null, - reservation_id bigint not null, - total_amount bigint not null, - order_id varchar(255) not null, - payment_key varchar(255) not null, - created_at datetime(6) null, - last_modified_at datetime(6) null, - constraint uk_payments__reservationId unique (reservation_id), - constraint fk_payments__reservationId foreign key (reservation_id) references reservations (reservation_id) -); - -create table if not exists canceled_payments -( - canceled_payment_id bigint primary key, - payment_key varchar(255) not null, - cancel_reason varchar(255) not null, - cancel_amount bigint not null, - approved_at datetime(6) not null, - canceled_at datetime(6) not null, - created_at datetime(6) null, - last_modified_at datetime(6) null -); - - -create table if not exists payment1 +create table if not exists payment ( id bigint primary key, reservation_id bigint not null, @@ -142,7 +112,7 @@ create table if not exists payment_detail supplied_amount integer not null, vat integer not null, - constraint fk_payment_detail__paymentId foreign key (payment_id) references payment1 (id) + constraint fk_payment_detail__paymentId foreign key (payment_id) references payment (id) ); create table if not exists payment_bank_transfer_detail @@ -181,7 +151,7 @@ create table if not exists payment_easypay_prepaid_detail constraint fk_payment_easypay_prepaid_detail__id foreign key (id) references payment_detail (id) ); -create table if not exists canceled_payment1 +create table if not exists canceled_payment ( id bigint primary key, payment_id bigint not null, @@ -194,7 +164,7 @@ create table if not exists canceled_payment1 transfer_discount_amount integer not null, easypay_discount_amount integer not null, - constraint uk_canceled_payment1__paymentId unique (payment_id), - constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment1(id), + constraint uk_canceled_payment__paymentId unique (payment_id), + constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment(id), constraint fk_canceled_payment__canceledBy foreign key (canceled_by) references members(member_id) );