diff --git a/service/src/main/resources/schema/schema-mysql.sql b/service/src/main/resources/schema/schema-mysql.sql index bc558c6d..c3a4ab47 100644 --- a/service/src/main/resources/schema/schema-mysql.sql +++ b/service/src/main/resources/schema/schema-mysql.sql @@ -128,7 +128,9 @@ create table if not exists schedule ( constraint uk_schedule__store_id_date_time_theme_id unique (store_id, date, time, theme_id), constraint fk_schedule__store_id foreign key (store_id) references store (id), - constraint fk_schedule__theme_id foreign key (theme_id) references theme (id) + constraint fk_schedule__theme_id foreign key (theme_id) references theme (id), + index idx_schedule__status_hold_expired_at (status, hold_expired_at, id), + index idx_schedule__status_date_theme_id_id (status, date, theme_id, id) ); create table if not exists reservation ( @@ -146,7 +148,9 @@ create table if not exists reservation ( updated_by bigint not null, constraint fk_reservation__user_id foreign key (user_id) references users (id), - constraint fk_reservation__schedule_id foreign key (schedule_id) references schedule (id) + constraint fk_reservation__schedule_id foreign key (schedule_id) references schedule (id), + index idx_reservation__schedule_id_status (schedule_id, status), + index idx_reservation__status_schedule_id_created_at (status, schedule_id, created_at) ); create table if not exists canceled_reservation (