-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathares.sql
61 lines (52 loc) · 1.37 KB
/
ares.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
create table User (
id bigint unique not null,
username varchar(128) unique not null,
email varchar(128) unique not null,
password char(128) not null,
avatar varchar(128),
primary key (id)
);
create table Guild (
id bigint not null,
name varchar(128) not null,
avatar varchar(128),
primary key (id)
);
create table Channel (
id bigint not null,
guild bigint not null,
name varchar(128) not null,
primary key (id),
foreign key (guild)
references Guild(id)
on delete cascade
on update cascade
);
create table UserGuild (
user_id bigint not null,
guild_id bigint not null,
primary key (user_id, guild_id),
foreign key (user_id)
references User(id)
on delete cascade
on update cascade,
foreign key (guild_id)
references Guild(id)
on delete cascade
on update cascade
);
create table Message (
id bigint not null,
author bigint not null,
channel bigint not null,
content text not null,
primary key (id),
foreign key (author)
references User(id)
on delete cascade
on update cascade,
foreign key (channel)
references Channel(id)
on delete cascade
on update cascade
);