feat: 스키마 파일 추가 및 ddl-auto validate 수정

This commit is contained in:
이상진 2025-08-02 15:49:25 +09:00
parent 9e86222d5b
commit d293b56b0f
3 changed files with 136 additions and 1 deletions

View File

@ -4,7 +4,7 @@ spring:
hibernate:
format_sql: true
hibernate:
ddl-auto: create-drop
ddl-auto: validate
h2:
console:
enabled: true
@ -15,6 +15,9 @@ spring:
driver-class-name: org.h2.Driver
username: sa
password:
sql:
init:
schema-locations: classpath:schema/schema-h2.sql
security:
jwt:

View File

@ -0,0 +1,63 @@
create table if not exists members (
member_id bigint primary key,
email varchar(255) not null,
name varchar(255) not null,
password varchar(255) not null,
role varchar(20) not null,
created_at timestamp null,
last_modified_at timestamp 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 timestamp null,
last_modified_at timestamp null
);
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 null,
last_modified_at timestamp 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 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 null,
last_modified_at timestamp 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 timestamp not null,
canceled_at timestamp not null,
created_at timestamp null,
last_modified_at timestamp null
);

View File

@ -0,0 +1,69 @@
create table if not exists members
(
member_id bigint primary key,
email varchar(255) not null,
name varchar(255) not null,
password varchar(255) not null,
role varchar(20) not null,
created_at datetime null,
last_modified_at datetime 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 null,
last_modified_at datetime null
);
create table if not exists times
(
time_id bigint primary key,
start_at time(6) not null,
created_at datetime null,
last_modified_at datetime 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 datetime null,
last_modified_at datetime 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 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 null,
last_modified_at datetime 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 null,
last_modified_at datetime null
);