feat: 결제 관련 새로운 스키마 정의

This commit is contained in:
이상진 2025-08-15 18:10:03 +09:00
parent 6cc7eb680c
commit ed0b81ff45
2 changed files with 164 additions and 10 deletions

View File

@ -14,8 +14,8 @@ create table if not exists members (
name varchar(255) not null, name varchar(255) not null,
password varchar(255) not null, password varchar(255) not null,
role varchar(20) not null, role varchar(20) not null,
created_at timestamp null, created_at timestamp,
last_modified_at timestamp null last_modified_at timestamp
); );
create table if not exists themes ( create table if not exists themes (
@ -23,8 +23,8 @@ create table if not exists themes (
description varchar(255) not null, description varchar(255) not null,
name varchar(255) not null, name varchar(255) not null,
thumbnail varchar(255) not null, thumbnail varchar(255) not null,
created_at timestamp null, created_at timestamp,
last_modified_at timestamp null last_modified_at timestamp
); );
create table if not exists times ( create table if not exists times (
@ -41,8 +41,9 @@ create table if not exists reservations (
theme_id bigint not null, theme_id bigint not null,
time_id bigint not null, time_id bigint not null,
status varchar(30) not null, status varchar(30) not null,
created_at timestamp null, created_at timestamp,
last_modified_at timestamp null, last_modified_at timestamp,
constraint fk_reservations__themeId foreign key (theme_id) references themes (theme_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__memberId foreign key (member_id) references members (member_id),
constraint fk_reservations__timeId foreign key (time_id) references times (time_id) constraint fk_reservations__timeId foreign key (time_id) references times (time_id)
@ -55,8 +56,9 @@ create table if not exists payments (
total_amount bigint not null, total_amount bigint not null,
order_id varchar(255) not null, order_id varchar(255) not null,
payment_key varchar(255) not null, payment_key varchar(255) not null,
created_at timestamp null, created_at timestamp,
last_modified_at timestamp null, last_modified_at timestamp,
constraint uk_payments__reservationId unique (reservation_id), constraint uk_payments__reservationId unique (reservation_id),
constraint fk_payments__reservationId foreign key (reservation_id) references reservations (reservation_id) constraint fk_payments__reservationId foreign key (reservation_id) references reservations (reservation_id)
); );
@ -68,6 +70,79 @@ create table if not exists canceled_payments (
cancel_amount bigint not null, cancel_amount bigint not null,
approved_at timestamp not null, approved_at timestamp not null,
canceled_at timestamp not null, canceled_at timestamp not null,
created_at timestamp null,
last_modified_at timestamp null created_at timestamp,
last_modified_at timestamp
);
create table if not exists payment1 (
id bigint primary key,
reservation_id bigint not null,
type varchar(20) not null,
method varchar(30) not null,
payment_key varchar(255) not null unique,
total_amount integer not null,
status varchar(20) not null,
requested_at timestamp not null,
approved_at timestamp not null,
constraint uk_payment__reservationId unique (reservation_id),
constraint fk_payment__reservationId foreign key (reservation_id) references reservations (reservation_id)
);
create table if not exists payment_detail(
id bigint primary key,
payment_id bigint not null unique,
net_amount integer not null,
vat integer not null,
constraint fk_payment_detail__paymentId foreign key (payment_id) references payment1 (id)
);
create table if not exists payment_bank_transfer_detail (
id bigint primary key,
bank_code varchar(10) not null,
constraint fk_payment_bank_transfer_details__id foreign key (id) references payment_detail (id)
);
create table if not exists payment_card_detail (
id bigint primary key,
issuer_code varchar(10) not null,
card_type varchar(10) not null,
owner_type varchar(10) not null,
amount integer not null,
card_number varchar(20) not null,
approval_number varchar(8) not null unique,
installment_plan_months tinyint not null,
is_interest_free boolean not null,
easypay_provider_code varchar(20),
easypay_discount_amount integer,
constraint fk_payment_card_detail__id foreign key (id) references payment_detail (id)
);
create table if not exists payment_easypay_prepaid_detail(
id bigint primary key,
easypay_provider_code varchar(20) not null,
amount integer not null,
discount_amount integer not null,
constraint fk_payment_easypay_prepaid_detail__id foreign key (id) references payment_detail (id)
);
create table if not exists canceled_payment1(
id bigint primary key,
payment_id bigint not null,
canceled_at timestamp not null,
canceled_by bigint not null,
cancel_reason varchar(255) not null,
cancel_amount integer not null,
cardDiscountAmount integer not null,
transferDiscountAmount integer not null,
easyPayDiscountAmount integer not null,
constraint uk_canceled_payment1__paymentId unique (payment_id),
constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment1(id),
constraint fk_canceled_payment__canceledBy foreign key (canceled_by) references members(member_id)
); );

View File

@ -77,3 +77,82 @@ create table if not exists canceled_payments
created_at datetime(6) null, created_at datetime(6) null,
last_modified_at datetime(6) null last_modified_at datetime(6) null
); );
create table if not exists payment1
(
id bigint primary key,
reservation_id bigint not null,
type varchar(20) not null,
method varchar(30) not null,
payment_key varchar(255) not null unique,
total_amount integer not null,
status varchar(20) not null,
requested_at datetime(6) not null,
approved_at datetime(6),
constraint uk_payment__reservationId unique (reservation_id),
constraint fk_payment__reservationId foreign key (reservation_id) references reservations (reservation_id)
);
create table if not exists payment_detail
(
id bigint primary key,
payment_id bigint not null unique,
net_amount integer not null,
vat integer not null,
constraint fk_payment_detail__paymentId foreign key (payment_id) references payment1 (id)
);
create table if not exists payment_bank_transfer_detail
(
id bigint primary key,
bank_code varchar(10) not null,
constraint fk_payment_bank_transfer_details__id foreign key (id) references payment_detail (id)
);
create table if not exists payment_card_detail
(
id bigint primary key,
issuer_code varchar(10) not null,
card_type varchar(10) not null,
owner_type varchar(10) not null,
amount integer not null,
card_number varchar(20) not null,
approval_number varchar(8) not null unique,
installment_plan_months tinyint not null,
is_interest_free boolean not null,
easypay_provider_code varchar(20),
easypay_discount_amount integer,
constraint fk_payment_card_detail__id foreign key (id) references payment_detail (id)
);
create table if not exists payment_easypay_prepaid_detail
(
id bigint primary key,
easypay_provider_code varchar(20) not null,
amount integer not null,
discount_amount integer not null,
constraint fk_payment_easypay_prepaid_detail__id foreign key (id) references payment_detail (id)
);
create table if not exists canceled_payment1
(
id bigint primary key,
payment_id bigint not null,
canceled_at datetime(6) not null,
canceled_by bigint not null,
cancel_reason varchar(255) not null,
cancel_amount integer not null,
cardDiscountAmount integer not null,
transferDiscountAmount integer not null,
easyPayDiscountAmount integer not null,
constraint uk_canceled_payment1__paymentId unique (payment_id),
constraint fk_canceled_payment__paymentId foreign key (payment_id) references payment1(id),
constraint fk_canceled_payment__canceledBy foreign key (canceled_by) references members(member_id)
);