-
Notifications
You must be signed in to change notification settings - Fork 0
/
seed.sql
36 lines (32 loc) · 984 Bytes
/
seed.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
DROP TABLE IF EXISTS Interviews;
CREATE TABLE IF NOT EXISTS Interviews (
id INTEGER PRIMARY KEY,
name TEXT,
token TEXT UNIQUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
DROP TABLE IF EXISTS Participants;
CREATE TABLE IF NOT EXISTS Participants (
id INTEGER PRIMARY KEY,
name TEXT,
email TEXT UNIQUE,
auth_token TEXT UNIQUE,
interview_id INTEGER,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (interview_id) REFERENCES Interviews(id)
);
DROP TABLE IF EXISTS CodeSubmissions;
CREATE TABLE IF NOT EXISTS CodeSubmissions (
id INTEGER PRIMARY KEY,
judge0_token INTEGER UNIQUE,
source_code TEXT,
stdout TEXT,
stderr TEXT,
compile_output TEXT,
language_id INTEGER,
interview_id INTEGER,
participant_id INTEGER,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (interview_id) REFERENCES Interviews(id),
FOREIGN KEY (participant_id) REFERENCES Participants(id)
);