-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSCHEMA.sql
More file actions
32 lines (30 loc) · 891 Bytes
/
SCHEMA.sql
File metadata and controls
32 lines (30 loc) · 891 Bytes
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
CREATE TABLE IF NOT EXISTS teams(
team_id BIGINT PRIMARY KEY,
token TEXT UNIQUE NOT NULL,
invite TEXT UNIQUE NOT NULL,
name TEXT UNIQUE NOT NULL,
github TEXT,
owner BIGINT UNIQUE NOT NULL,
role_id BIGINT UNIQUE NOT NULL,
text_id BIGINT UNIQUE NOT NULL,
voice_id BIGINT UNIQUE NOT NULL,
created TIMESTAMP DEFAULT (now() at time zone 'utc')
);
CREATE TABLE IF NOT EXISTS members(
member_id BIGINT PRIMARY KEY,
languages INT[],
timezone INTERVAL,
solo BOOLEAN,
team_id BIGINT,
registered TIMESTAMP DEFAULT (now() at time zone 'utc'),
FOREIGN KEY (team_id) REFERENCES teams (team_id) ON DELETE SET NULL
);
CREATE TABLE IF NOT EXISTS error_log(
id SERIAL PRIMARY KEY,
channel BIGINT,
invoker BIGINT,
command TEXT,
error TEXT,
traceback TEXT,
created TIMESTAMP DEFAULT (now() at time zone 'utc')
);