[#41] 예약 스키마 재정의 #42

Merged
pricelees merged 41 commits from refactor/#41 into main 2025-09-09 00:43:39 +00:00
2 changed files with 36 additions and 123 deletions
Showing only changes of commit 11fd345d5e - Show all commits

View File

@ -18,15 +18,6 @@ create table if not exists members (
last_modified_at timestamp 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 ( create table if not exists theme (
id bigint primary key , id bigint primary key ,
name varchar(30) not null, 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) 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 ( create table if not exists reservation (
id bigint primary key, id bigint primary key,
member_id bigint not null, 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) constraint fk_canceled_reservations__canceled_by foreign key (canceled_by) references members (member_id)
); );
create table if not exists payments ( create table if not exists payment (
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 (
id bigint primary key, id bigint primary key,
reservation_id bigint not null, reservation_id bigint not null,
type varchar(20) not null, type varchar(20) not null,
@ -167,7 +110,7 @@ create table if not exists payment_detail(
supplied_amount integer not null, supplied_amount integer not null,
vat 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 ( 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) 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, id bigint primary key,
payment_id bigint not null, payment_id bigint not null,
requested_at timestamp not null, requested_at timestamp not null,
@ -215,7 +158,7 @@ create table if not exists canceled_payment1(
transfer_discount_amount integer not null, transfer_discount_amount integer not null,
easypay_discount_amount integer not null, easypay_discount_amount integer not null,
constraint uk_canceled_payment1__paymentId unique (payment_id), constraint uk_canceled_payment__paymentId unique (payment_id),
constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment1(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) constraint fk_canceled_payment__canceledBy foreign key (canceled_by) references members(member_id)
); );

View File

@ -19,16 +19,6 @@ create table if not exists members
last_modified_at datetime(6) null 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 ( create table if not exists theme (
id bigint primary key , id bigint primary key ,
name varchar(30) not null, 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) constraint fk_schedule__theme_id foreign key (theme_id) references theme (id)
); );
create table if not exists times create table if not exists reservation (
( id bigint primary key,
time_id bigint primary key, member_id bigint not null,
start_at time(6) not null, schedule_id bigint not null,
created_at datetime(6) null, reserver_name varchar(30) not null,
last_modified_at datetime(6) 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 create table if not exists canceled_reservation (
( id bigint primary key,
reservation_id bigint primary key, reservation_id bigint not null,
date date not null, canceled_by bigint not null,
member_id bigint not null, cancel_reason varchar(50) not null,
theme_id bigint not null, canceled_at datetime(6) not null,
time_id bigint not null, status varchar(30) not null,
status varchar(30) not null, constraint uk_canceled_reservations__reservation_id unique (reservation_id),
created_at datetime(6) null, constraint fk_canceled_reservations__reservation_id foreign key (reservation_id) references reservation (id),
last_modified_at datetime(6) null, constraint fk_canceled_reservations__canceled_by foreign key (canceled_by) references members (member_id)
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 payments create table if not exists payment
(
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
( (
id bigint primary key, id bigint primary key,
reservation_id bigint not null, reservation_id bigint not null,
@ -142,7 +112,7 @@ create table if not exists payment_detail
supplied_amount integer not null, supplied_amount integer not null,
vat 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 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) 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, id bigint primary key,
payment_id bigint not null, payment_id bigint not null,
@ -194,7 +164,7 @@ create table if not exists canceled_payment1
transfer_discount_amount integer not null, transfer_discount_amount integer not null,
easypay_discount_amount integer not null, easypay_discount_amount integer not null,
constraint uk_canceled_payment1__paymentId unique (payment_id), constraint uk_canceled_payment__paymentId unique (payment_id),
constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment1(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) constraint fk_canceled_payment__canceledBy foreign key (canceled_by) references members(member_id)
); );