-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sql
39 lines (32 loc) · 816 Bytes
/
setup.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
CREATE TABLE IF NOT EXISTS comments (
comment_id VARCHAR PRIMARY KEY
);
CREATE TABLE IF NOT EXISTS se_comments (
comment_id VARCHAR PRIMARY KEY
);
CREATE TABLE IF NOT EXISTS se_posts (
post_id VARCHAR PRIMARY KEY
);
CREATE TABLE IF NOT EXISTS names (
name VARCHAR PRIMARY KEY,
img_url VARCHAR
);
CREATE TABLE IF NOT EXISTS nba_comments (
comment_id VARCHAR PRIMARY KEY,
comment VARCHAR,
author VARCHAR,
link VARCHAR,
timestamp INTEGER
);
CREATE TABLE IF NOT EXISTS mentions (
name VARCHAR,
comment_id VARCHAR,
mention VARCHAR,
mention_type VARCHAR,
PRIMARY KEY(name, comment_id),
FOREIGN KEY (name) REFERENCES names(name) ON DELETE CASCADE,
FOREIGN KEY (comment_id) REFERENCES nba_comments(comment_id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS ip_addrs (
ip_addr VARCHAR PRIMARY KEY
);