-
Notifications
You must be signed in to change notification settings - Fork 2
/
db_schema.sql
67 lines (57 loc) · 1.33 KB
/
db_schema.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
56
57
58
59
60
61
62
63
64
65
66
create table if not exists server
(
server_id text not null
constraint id
unique,
server_ip text not null,
server_name text,
constraint server_pkey
primary key (server_id, server_ip)
);
alter table server owner to postgres;
create table if not exists users
(
username text not null,
password text not null,
salt text not null,
email text not null,
id bigserial not null
constraint users_pkey
primary key
);
alter table users owner to postgres;
create table if not exists user_code
(
user_id integer not null
constraint user_code_pkey
primary key
constraint userid
references users
on delete cascade,
code text not null
);
alter table user_code owner to postgres;
create table if not exists user_server
(
user_id integer not null
constraint "user"
references users,
server_id text not null
constraint server
references server (server_id),
constraint user_server_pkey
primary key (user_id, server_id)
);
alter table user_server owner to postgres;
create table if not exists user_access_token
(
user_id integer not null
constraint user_access_token_user_id_fkey
references users
on delete cascade,
access_token text not null,
refresh_token text not null,
constraint user_access_token_pkey
primary key (user_id, access_token, refresh_token)
);
alter table user_access_token owner to postgres;