mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-01 16:01:03 +00:00
32 lines
1,006 B
MySQL
32 lines
1,006 B
MySQL
|
-- Your SQL goes here
|
||
|
|
||
|
CREATE TABLE timeline_definition(
|
||
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||
|
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
|
||
|
name VARCHAR NOT NULL,
|
||
|
query VARCHAR NOT NULL,
|
||
|
CONSTRAINT timeline_unique_user_name UNIQUE(user_id, name)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE timeline(
|
||
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||
|
post_id integer NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
|
||
|
timeline_id integer NOT NULL REFERENCES timeline_definition(id) ON DELETE CASCADE
|
||
|
);
|
||
|
|
||
|
CREATE TABLE lists(
|
||
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||
|
name VARCHAR NOT NULL,
|
||
|
user_id integer REFERENCES users(id) ON DELETE CASCADE,
|
||
|
type integer NOT NULL,
|
||
|
CONSTRAINT timeline_unique_user_name UNIQUE(user_id, name)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE list_elems(
|
||
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||
|
list_id integer NOT NULL REFERENCES lists(id) ON DELETE CASCADE,
|
||
|
user_id integer REFERENCES users(id) ON DELETE CASCADE,
|
||
|
blog_id integer REFERENCES blogs(id) ON DELETE CASCADE,
|
||
|
word VARCHAR
|
||
|
);
|