-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
32 lines (27 loc) · 794 Bytes
/
schema.sql
File metadata and controls
32 lines (27 loc) · 794 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 EXTENSION IF NOT EXISTS pg_trgm;
CREATE TABLE IF NOT EXISTS user_notes (
id BIGSERIAL,
user_id BIGINT NOT NULL,
target_id BIGINT NOT NULL,
content VARCHAR(2000),
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS whitelist(
entity_id BIGINT PRIMARY KEY,
is_user BOOLEAN DEFAULT TRUE
);
CREATE TABLE IF NOT EXISTS user_settings(
user_id BIGINT PRIMARY KEY,
notifications_enabled BOOLEAN DEFAULT TRUE
);
CREATE TABLE IF NOT EXISTS warned(
user_id BIGINT,
thread_id BIGINT,
PRIMARY KEY (user_id, thread_id)
);
CREATE TABLE IF NOT EXISTS user_muted_notes(
note_id BIGINT REFERENCES user_notes(id) ON DELETE CASCADE,
user_id BIGINT,
PRIMARY KEY (note_id, user_id)
);