-
Notifications
You must be signed in to change notification settings - Fork 13
/
create.sql
33 lines (31 loc) · 831 Bytes
/
create.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
CREATE TABLE users
(
password TEXT NOT NULL,
username TEXT NOT NULL,
token TEXT,
CONSTRAINT username PRIMARY KEY (username)
);
CREATE TABLE files
(
id TEXT NOT NULL,
owner TEXT NOT NULL,
extension TEXT,
created integer NOT NULL DEFAULT (strftime('%s','now')),
CONSTRAINT files_pkey PRIMARY KEY (id),
CONSTRAINT fk_owner FOREIGN KEY (owner)
REFERENCES users (username) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE CASCADE
);
CREATE TABLE links
(
id TEXT NOT NULL,
url TEXT NOT NULL,
owner TEXT NOT NULL,
created integer NOT NULL DEFAULT (strftime('%s','now')),
CONSTRAINT main PRIMARY KEY (id),
CONSTRAINT owner_check FOREIGN KEY (owner)
REFERENCES users (username) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE CASCADE
);