|
100 | 100 | updated_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP, |
101 | 101 | constraint user_uq unique (name) |
102 | 102 | ) comment '유저'; |
| 103 | +</details> |
| 104 | +<details close> |
| 105 | + <summary>play_record</summary> |
| 106 | + |
| 107 | + create table play_record ( |
| 108 | + user_id int unsigned not null, |
| 109 | + page_id int unsigned not null, |
| 110 | + detail_log json not null comment '상세 기록', |
| 111 | + created_at datetime default CURRENT_TIMESTAMP not null, |
| 112 | + updated_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP, |
| 113 | + primary key (user_id, page_id), |
| 114 | + constraint play_record_page_id_fk |
| 115 | + foreign key (page_id) references page (id) |
| 116 | + on delete cascade, |
| 117 | + constraint play_record_user_id_fk |
| 118 | + foreign key (user_id) references user (id) |
| 119 | + on delete cascade |
| 120 | + ) comment '플레이 기록'; |
| 121 | + |
| 122 | + create index play_record_updated_at_index |
| 123 | + on play_record (updated_at desc); |
| 124 | +</details> |
| 125 | +<details close> |
| 126 | + <summary>play_status</summary> |
| 127 | + |
| 128 | + create table play_status ( |
| 129 | + user_id int unsigned not null primary key, |
| 130 | + move_target_type tinyint unsigned not null comment '1: 페이지, 2: 엔딩', |
| 131 | + target_id int unsigned not null comment '다음 페이지 id or 엔딩 id', |
| 132 | + owned_items json not null comment '현재 소유한 아이템 정보', |
| 133 | + created_at datetime default CURRENT_TIMESTAMP not null, |
| 134 | + updated_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP, |
| 135 | + constraint play_status_user_id_fk |
| 136 | + foreign key (user_id) references user (id) |
| 137 | + on delete cascade |
| 138 | + ) comment '유저의 현재 플레이 상태'; |
| 139 | + |
| 140 | + create index play_status_target_id_index |
| 141 | + on play_status (target_id); |
103 | 142 | </details> |
0 commit comments