|
| 1 | +-- 기존 운영 DB에 반영된 테이블 구조 |
| 2 | +create table changed_routine |
| 3 | +( |
| 4 | + changed_execution_time time(6) not null, |
| 5 | + changed_routine_date date not null, |
| 6 | + original_routine_date date not null, |
| 7 | + created_at timestamp not null, |
| 8 | + deleted_at datetime(6) null, |
| 9 | + history_end_date_time datetime(6) not null, |
| 10 | + history_seq bigint not null, |
| 11 | + history_start_date_time datetime(6) not null, |
| 12 | + updated_at timestamp null, |
| 13 | + changed_routine_id binary(16) not null, |
| 14 | + routine_id binary(16) null, |
| 15 | + user_id binary(16) not null, |
| 16 | + changed_routine_name varchar(255) not null, |
| 17 | + changed_div_code varchar(40) null, |
| 18 | + primary key (history_seq, changed_routine_id) |
| 19 | +); |
| 20 | + |
| 21 | +create table changed_sub_routine |
| 22 | +( |
| 23 | + sort_order int not null, |
| 24 | + created_at timestamp not null, |
| 25 | + deleted_at datetime(6) null, |
| 26 | + history_end_date_time datetime(6) not null, |
| 27 | + history_seq bigint not null, |
| 28 | + history_start_date_time datetime(6) not null, |
| 29 | + updated_at timestamp null, |
| 30 | + changed_routine_id binary(16) not null, |
| 31 | + changed_sub_routine_id binary(16) not null, |
| 32 | + changed_sub_routine_name varchar(255) not null, |
| 33 | + primary key (history_seq, changed_sub_routine_id) |
| 34 | +); |
| 35 | + |
| 36 | +create table emotion_marble |
| 37 | +( |
| 38 | + date date not null, |
| 39 | + case_id bigint not null, |
| 40 | + created_at timestamp not null, |
| 41 | + deleted_at datetime(6) null, |
| 42 | + history_end_date_time datetime(6) not null, |
| 43 | + history_seq bigint not null, |
| 44 | + history_start_date_time datetime(6) not null, |
| 45 | + updated_at timestamp null, |
| 46 | + emotion_marble_id binary(16) not null, |
| 47 | + user_id binary(16) not null, |
| 48 | + emotion_marble_type varchar(40) not null, |
| 49 | + primary key (history_seq, emotion_marble_id) |
| 50 | +); |
| 51 | + |
| 52 | +create table onboarding |
| 53 | +( |
| 54 | + time_slot time(6) not null, |
| 55 | + case_id bigint not null, |
| 56 | + created_at timestamp not null, |
| 57 | + deleted_at datetime(6) null, |
| 58 | + onboarding_id bigint auto_increment |
| 59 | + primary key, |
| 60 | + updated_at timestamp null, |
| 61 | + emotion_type varchar(40) not null, |
| 62 | + real_outing_frequency varchar(40) not null, |
| 63 | + target_outing_frequency varchar(40) not null |
| 64 | +); |
| 65 | + |
| 66 | +create table recommended_routine |
| 67 | +( |
| 68 | + execution_time time(6) null, |
| 69 | + case_id bigint null, |
| 70 | + created_at timestamp not null, |
| 71 | + deleted_at datetime(6) null, |
| 72 | + recommended_routine_id bigint auto_increment |
| 73 | + primary key, |
| 74 | + updated_at timestamp null, |
| 75 | + recommended_routine_description varchar(255) null, |
| 76 | + recommended_routine_name varchar(255) null, |
| 77 | + thumbnail_url varchar(255) null, |
| 78 | + emotion varchar(40) null, |
| 79 | + recommended_routine_level varchar(40) null, |
| 80 | + recommended_routine_type varchar(40) null |
| 81 | +); |
| 82 | + |
| 83 | +create table recommended_sub_routine |
| 84 | +( |
| 85 | + created_at timestamp not null, |
| 86 | + deleted_at datetime(6) null, |
| 87 | + recommended_routine_id bigint null, |
| 88 | + recommended_sub_routine_id bigint auto_increment |
| 89 | + primary key, |
| 90 | + updated_at timestamp null, |
| 91 | + sub_routine_name varchar(255) null |
| 92 | +); |
| 93 | + |
| 94 | +create table routine |
| 95 | +( |
| 96 | + execution_time time(6) not null, |
| 97 | + created_at timestamp not null, |
| 98 | + deleted_at datetime(6) null, |
| 99 | + history_end_date_time datetime(6) not null, |
| 100 | + history_seq bigint not null, |
| 101 | + history_start_date_time datetime(6) not null, |
| 102 | + updated_at timestamp null, |
| 103 | + routine_id binary(16) not null, |
| 104 | + user_id binary(16) not null, |
| 105 | + name varchar(255) not null, |
| 106 | + repeat_day varchar(255) not null, |
| 107 | + primary key (history_seq, routine_id) |
| 108 | +); |
| 109 | + |
| 110 | +create table routine_case |
| 111 | +( |
| 112 | + case_id bigint auto_increment |
| 113 | + primary key, |
| 114 | + created_at timestamp not null, |
| 115 | + deleted_at datetime(6) null, |
| 116 | + updated_at timestamp null |
| 117 | +); |
| 118 | + |
| 119 | +create table routine_completion |
| 120 | +( |
| 121 | + complete_yn bit not null, |
| 122 | + performed_date date not null, |
| 123 | + created_at timestamp not null, |
| 124 | + deleted_at datetime(6) null, |
| 125 | + routine_completion_id bigint auto_increment |
| 126 | + primary key, |
| 127 | + routine_history_seq bigint not null, |
| 128 | + updated_at timestamp null, |
| 129 | + routine_id binary(16) not null, |
| 130 | + routine_type varchar(40) not null |
| 131 | +); |
| 132 | + |
| 133 | +create table sub_routine |
| 134 | +( |
| 135 | + sort_order int not null, |
| 136 | + created_at timestamp not null, |
| 137 | + deleted_at datetime(6) null, |
| 138 | + history_end_date_time datetime(6) not null, |
| 139 | + history_seq bigint not null, |
| 140 | + history_start_date_time datetime(6) not null, |
| 141 | + updated_at timestamp null, |
| 142 | + routine_id binary(16) not null, |
| 143 | + sub_routine_id binary(16) not null, |
| 144 | + name varchar(255) not null, |
| 145 | + primary key (history_seq, sub_routine_id) |
| 146 | +); |
| 147 | + |
| 148 | +create table user |
| 149 | +( |
| 150 | + agreed_to_privacy_policy bit null, |
| 151 | + agreed_to_terms_of_service bit null, |
| 152 | + is_over_fourteen bit null, |
| 153 | + created_at timestamp not null, |
| 154 | + deleted_at datetime(6) null, |
| 155 | + history_end_date_time datetime(6) not null, |
| 156 | + history_seq bigint not null, |
| 157 | + history_start_date_time datetime(6) not null, |
| 158 | + onboarding_id bigint null, |
| 159 | + updated_at timestamp null, |
| 160 | + user_id binary(16) not null, |
| 161 | + email varchar(255) not null, |
| 162 | + nickname varchar(255) not null, |
| 163 | + refresh_token varchar(255) null, |
| 164 | + social_id varchar(255) not null, |
| 165 | + role varchar(40) not null, |
| 166 | + social_type varchar(40) null, |
| 167 | + primary key (history_seq, user_id) |
| 168 | +); |
| 169 | + |
0 commit comments