-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathddl.sql
More file actions
209 lines (192 loc) · 6.63 KB
/
Copy pathddl.sql
File metadata and controls
209 lines (192 loc) · 6.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
create table question
(
id bigint auto_increment,
content text not null,
title varchar(255) not null,
category enum ('BACKEND','FRONTEND') not null,
created_at timestamp(6),
updated_at timestamp(6),
primary key (id)
);
create table subscribe
(
id bigint auto_increment,
email varchar(255) not null,
category enum ('BACKEND','FRONTEND') not null,
frequency enum ('DAILY','WEEKLY') not null default 'DAILY',
next_question_sequence bigint not null default '0',
token varchar(255) not null,
created_at timestamp(6),
updated_at timestamp(6),
deleted_at timestamp(6),
primary key (id),
unique key `subscribe_token_unique` (token)
);
create table mail_event
(
id bigint auto_increment,
is_success boolean not null,
email varchar(255) not null,
type varchar(255) not null,
created_at timestamp(6),
updated_at timestamp(6),
primary key (id)
);
create table admin
(
id bigint auto_increment,
email varchar(255) not null,
created_at timestamp(6),
updated_at timestamp(6),
primary key (id)
);
create table temporal_subscribe
(
id bigint auto_increment,
email varchar(255) not null,
verify_code varchar(255) not null,
is_verified boolean not null,
created_at timestamp(6),
updated_at timestamp(6),
primary key (id)
);
create table subscribe_question
(
id bigint auto_increment,
question_id bigint,
subscribe_id bigint,
is_success boolean not null,
created_at timestamp(6),
updated_at timestamp(6),
primary key (id),
constraint `fk_subscribe_question_question_id` foreign key (`question_id`) references `question` (`id`),
constraint `fk_subscribe_question_subscribe_id` foreign key (`subscribe_id`) references `subscribe` (`id`)
);
create table admin_notice
(
id bigint auto_increment,
title varchar(255) not null,
content text not null,
reserved_at timestamp(6) not null,
created_at timestamp(6),
updated_at timestamp(6),
primary key (id)
);
create table member
(
id bigint auto_increment,
name varchar(255) not null,
provider_id varchar(255) not null,
provider varchar(10) not null,
github_url varchar(255),
refresh_token varchar(255) not null,
profile_image_url varchar(255),
created_at timestamp(6) not null,
updated_at timestamp(6) not null,
deleted_at timestamp(6),
primary key (id),
unique key `member_provider_id_unique` (provider_id),
unique key `member_refresh_token_unique` (refresh_token)
);
create table wiki
(
id bigint auto_increment,
member_id bigint not null,
question varchar(255) not null,
question_detail text,
category varchar(10) not null,
is_anonymous boolean not null,
created_at timestamp(6) not null,
updated_at timestamp(6) not null,
deleted_at timestamp(6),
primary key (id),
constraint `fk_wiki_member_id` foreign key (member_id) references member (id)
);
create table comment
(
id bigint auto_increment,
member_id bigint not null,
wiki_id bigint not null,
answer text not null,
is_anonymous boolean not null,
created_at timestamp(6) not null,
updated_at timestamp(6) not null,
deleted_at timestamp(6),
primary key (id),
constraint `fk_comment_wiki_id` foreign key (wiki_id) references wiki (id),
constraint `fk_comment_member_id` foreign key (member_id) references member (id)
);
create table comment_like
(
id bigint auto_increment,
member_id bigint not null,
comment_id bigint not null,
created_at timestamp(6) not null,
primary key (id),
unique key `comment_like_member_id_comment_id_unique` (member_id, comment_id),
constraint `fk_comment_like_comment_id` foreign key (comment_id) references comment (id),
constraint `fk_comment_like_member_id` foreign key (member_id) references member (id)
);
create table multiple_choice_option
(
id bigint not null auto_increment,
content varchar(255) not null,
is_correct_answer boolean not null,
question_id bigint not null,
created_at timestamp(6) not null,
updated_at timestamp(6) not null,
primary key (id),
constraint `fk_multiple_choice_option_question_id` foreign key (question_id) references multiple_choice_question (id)
);
create table multiple_choice_question
(
id bigint not null auto_increment,
title varchar(255) not null,
correct_answer_explanation text,
workbook_id bigint not null,
created_at timestamp(6) not null,
updated_at timestamp(6) not null,
primary key (id),
constraint `fk_multiple_choice_question_workbook_id` foreign key (workbook_id) references multiple_choice_workbook (id)
);
create table multiple_choice_workbook
(
id bigint not null auto_increment,
title varchar(255) not null,
difficulty_level int not null,
category varchar(10) not null,
workbook_detail text,
time_limit int,
solved_count int not null,
member_id bigint not null,
created_at timestamp(6) not null,
updated_at timestamp(6) not null,
primary key (id),
constraint `fk_multiple_choice_workbook_member_id` foreign key (member_id) references member (id)
);
create table category_policy
(
id bigint auto_increment,
category enum ('BACKEND','FRONTEND') not null,
start_question_id bigint not null,
primary key (id),
unique key `category_policy_category_unique` (category),
constraint `fk_category_policy_start_question_id` foreign key (`start_question_id`) references `question` (`id`)
);
create table forward_log
(
id bigint not null auto_increment,
target varchar(255) not null,
subject varchar(255) not null,
message text not null,
status varchar(50) not null,
created_at timestamp(6) not null,
updated_at timestamp(6) not null,
primary key (id)
);
create table if not exists bucket
(
id bigint not null auto_increment,
state blob null,
primary key (id)
);