-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_schema.sql
83 lines (58 loc) · 2.47 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
-- DDL generated by Postico 1.5.5
-- Not all database features are supported. Do not use for backup.
-- Table Definition ----------------------------------------------
CREATE TABLE games (
id uuid PRIMARY KEY,
teacherid uuid NOT NULL REFERENCES teachers(id),
name character varying(64) NOT NULL,
gametype character varying(64) NOT NULL,
options jsonb,
code character(6) NOT NULL
);
-- Indices -------------------------------------------------------
CREATE UNIQUE INDEX games_pkey ON games(id uuid_ops);
-- DDL generated by Postico 1.5.5
-- Not all database features are supported. Do not use for backup.
-- Table Definition ----------------------------------------------
CREATE TABLE games_played (
id uuid PRIMARY KEY,
studentid uuid NOT NULL REFERENCES students(id),
gameid uuid NOT NULL REFERENCES games(id),
results jsonb
);
-- Indices -------------------------------------------------------
CREATE UNIQUE INDEX games_played_pkey ON games_played(id uuid_ops);
-- DDL generated by Postico 1.5.5
-- Not all database features are supported. Do not use for backup.
-- Table Definition ----------------------------------------------
CREATE TABLE students (
id uuid PRIMARY KEY,
firstname character varying(64),
lastname character varying(64),
username character varying(128),
password character(60)
);
-- Indices -------------------------------------------------------
CREATE UNIQUE INDEX students_pkey ON students(id uuid_ops);
-- DDL generated by Postico 1.5.5
-- Not all database features are supported. Do not use for backup.
-- Table Definition ----------------------------------------------
CREATE TABLE teacher_student_bridge (
id SERIAL PRIMARY KEY,
teacherid uuid NOT NULL REFERENCES teachers(id) ON UPDATE CASCADE,
studentid uuid NOT NULL REFERENCES students(id) ON UPDATE CASCADE
);
-- Indices -------------------------------------------------------
CREATE UNIQUE INDEX teacher_student_bridge_pkey ON teacher_student_bridge(id int4_ops);
-- DDL generated by Postico 1.5.5
-- Not all database features are supported. Do not use for backup.
-- Table Definition ----------------------------------------------
CREATE TABLE teachers (
id uuid PRIMARY KEY,
firstname character varying(64),
lastname character varying(64),
email character varying(128),
password character(60)
);
-- Indices -------------------------------------------------------
CREATE UNIQUE INDEX teachers_pkey ON teachers(id uuid_ops);