-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtables.sql
More file actions
34 lines (28 loc) · 888 Bytes
/
tables.sql
File metadata and controls
34 lines (28 loc) · 888 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
33
34
CREATE TABLE inscrits (
email text PRIMARY KEY
);
CREATE TABLE tickets (
id text PRIMARY KEY
);
CREATE TABLE grups (
grup_name text PRIMARY KEY,
project_url text DEFAULT NULL
);
CREATE TABLE participants (
email text PRIMARY KEY,
discord_id text NOT NULL UNIQUE CHECK (discord_id <> ''),
discord_tag text NOT NULL UNIQUE CHECK (discord_tag <> ''),
ticket text NOT NULL UNIQUE,
grup text DEFAULT NULL,
FOREIGN KEY(email) references inscrits(email),
FOREIGN KEY(ticket) references tickets(id),
FOREIGN KEY(grup) references grups(grup_name)
);
CREATE TABLE votes (
discord_id text,
grup_name text,
punt integer,
PRIMARY KEY(discord_id, grup_name),
FOREIGN KEY(discord_id) references participants(discord_id),
FOREIGN KEY(grup_name) references grups(grup_name)
);