-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.sql
54 lines (48 loc) · 1.08 KB
/
db.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
DROP SCHEMA IF EXISTS yatzy CASCADE;
CREATE SCHEMA yatzy;
SET search_path = yatzy;
CREATE TABLE spiller
(
brukernavn VARCHAR(20),
navn VARCHAR(50),
epost VARCHAR(50),
pwd_hash VARCHAR,
pwd_salt VARCHAR,
PRIMARY KEY (brukernavn)
);
CREATE TABLE yatzy
(
id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
antall INTEGER,
aktiv INTEGER,
runde INTEGER,
playerTurn INTEGER,
turnsPlayed INTEGER,
brett VARCHAR,
terninger VARCHAR,
PRIMARY KEY (id)
);
CREATE TABLE spilldeltagelse
(
id INTEGER,
brukernavn VARCHAR(20),
PRIMARY KEY (id, brukernavn),
FOREIGN KEY (id) REFERENCES yatzy(id),
FOREIGN KEY (brukernavn) REFERENCES spiller (brukernavn)
);
INSERT INTO spiller VALUES
(
'Dpshark',
'Daniel',
'Test@gmail.com',
'FBEAD197F4B938CDD4F072C0256186606F02778459DF74A26B87A7F3AAD3548C',
'A54AC2BB91A77759B85E0DD858AC14CA'
);
INSERT INTO spiller VALUES
(
'Testt',
'Test',
'Test@gmail.com',
'13793FAB9961823134C426613E12FFD868224A38E010AE2AF873097E2D78AC60',
'D538A919D71A2D03082EC456E4CBADDE'
);