-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sql
55 lines (55 loc) · 1.47 KB
/
init.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
CREATE TABLE channels (
uuid BigInt PRIMARY KEY NOT NULL,
name text NOT NULL
);
CREATE TABLE messages (
uuid BigInt PRIMARY KEY NOT NULL,
content text NOT NULL,
author_uuid BigInt NOT NULL,
channel_uuid BigInt NOT NULL,
date integer NOT NULL, edited Integer not null default 0,
FOREIGN KEY (author_uuid) REFERENCES users(uuid),
FOREIGN KEY (channel_uuid) REFERENCES channels(uuid)
);
CREATE TABLE users (
uuid BigInt PRIMARY KEY NOT NULL,
name text NOT NULL,
pfp text NOT NULL,
group_uuid BigInt NOT NULL,
password text NOT NULL,
FOREIGN KEY (group_uuid) REFERENCES groups(uuid)
);
CREATE TABLE groups (
uuid BigInt PRIMARY KEY NOT NULL,
permissions BigInt NOT NULL,
name text NOT NULL,
colour integer NOT NULL
);
CREATE TABLE user_groups (
link_id INTEGER PRIMARY KEY AUTOINCREMENT,
user_uuid BigInt NOT NULL,
group_uuid BigInt NOT NULL,
FOREIGN KEY (user_uuid) REFERENCES users(uuid),
FOREIGN KEY (group_uuid) REFERENCES groups(uuid)
);
CREATE TABLE sync_data (
user_uuid BigInt PRIMARY KEY NOT NULL,
uname text NOT NULL,
pfp text NOT NULL
);
CREATE TABLE emojis (
uuid BigInt PRIMARY KEY NOT NULL,
name text NOT NULL,
data text NOT NULL
);
CREATE TABLE sync_servers (
user_uuid BigInt NOT NULL,
uuid BigInt,
uname Text NOT NULL,
ip Text NOT NULL,
port Integer NOT NULL,
pfp Text,
name Text,
idx Integer NOT NULL,
rowid Integer NOT NULL PRIMARY KEY
);