-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
55 lines (50 loc) · 1.53 KB
/
schema.sql
File metadata and controls
55 lines (50 loc) · 1.53 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
create database sotd default character set 'utf8mb4';
use sotd;
-- MySQL
create table full_text (
text_key int not null auto_increment
, comment_id varchar(16) not null
, full_text text
, primary key (text_key)
)
;
create table submission (
submission_id varchar(16) not null
, title varchar(255) not null
, permalink varchar(255) not null
, created_time datetime -- local time
, post_date date not null
, primary key (submission_id)
)
;
-- Reddit IDs need 13 chars to store 64 bits...
-- 16 chars yields space for 82 bit unsigned integers (and then some).
create table comment (
comment_id varchar(16) not null
, created_time datetime not null -- local time
, edited_time datetime -- local time
, author_name varchar(255)
, parent_id varchar(16)
, score int
, permalink varchar(1024) not null
, submission_id varchar(16) not null
, plaintext_key int
, html_key int
, duplicate_comment_id varchar(16)
, primary key (comment_id)
, foreign key (plaintext_key) references full_text(text_key)
, foreign key (html_key) references full_text(text_key)
, foreign key (submission_id) references submission(submission_id)
)
;
create table lather (
lather_key int not null auto_increment
, comment_id varchar(16) not null
, maker varchar(255) not null
, scent varchar(255)
, confidence varchar(16) not null
, manual_ind tinyint not null default 0
, primary key (lather_key)
, foreign key (comment_id) references comment(comment_id)
)
;