-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathddl.sql
139 lines (129 loc) · 4.39 KB
/
ddl.sql
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
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)
);