Voyage/voyage.sql

36 lines
905 B
MySQL
Raw Normal View History

2019-12-11 19:47:19 -05:00
CREATE TABLE IF NOT EXISTS thread (
2019-12-06 18:13:43 -05:00
id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
time TIMESTAMP WITH TIME ZONE NOT NULL
);
2019-12-11 19:47:19 -05:00
CREATE TABLE IF NOT EXISTS post (
2019-12-06 18:13:43 -05:00
thread_id INTEGER REFERENCES thread(id) ON DELETE CASCADE NOT NULL,
id INTEGER PRIMARY KEY,
2020-01-20 13:18:47 -05:00
subject TEXT,
2019-12-06 18:13:43 -05:00
name TEXT NOT NULL,
2020-01-20 13:18:47 -05:00
email TEXT,
2019-12-11 19:47:19 -05:00
tripcode TEXT,
2020-01-20 13:18:47 -05:00
user_id TEXT,
2019-12-06 18:13:43 -05:00
time TIMESTAMP WITH TIME ZONE NOT NULL,
body TEXT NOT NULL
);
2019-12-11 19:47:19 -05:00
CREATE TABLE IF NOT EXISTS link (
2019-12-06 18:13:43 -05:00
link_from INTEGER REFERENCES post(id) ON DELETE CASCADE NOT NULL,
2019-12-11 19:47:19 -05:00
link_to INTEGER REFERENCES post(id) ON DELETE CASCADE NOT NULL,
PRIMARY KEY (link_from, link_to)
2019-12-06 18:13:43 -05:00
);
2019-12-11 19:47:19 -05:00
CREATE TABLE IF NOT EXISTS tag (
2019-12-06 18:13:43 -05:00
post_id INTEGER REFERENCES post(id) ON DELETE CASCADE NOT NULL,
2019-12-11 19:47:19 -05:00
name TEXT NOT NULL,
PRIMARY KEY (post_id, name)
);
CREATE TABLE IF NOT EXISTS file (
2019-12-17 18:46:54 -05:00
post_id INTEGER REFERENCES post(id) ON DELETE CASCADE NOT NULL,
chan_file_name TEXT,
original_file_name TEXT
2019-12-06 18:13:43 -05:00
);