2
DO NOT APPLY THIS MIGRATION WITHOUT READING THE FOLLOWING;
4
DROP TABLE problem_attempt_breakdown;
5
DROP TABLE problem_test_case_tag;
6
DROP TABLE problem_tag;
7
DROP TABLE problem_test_case;
8
DROP TABLE problem_prerequisite;
9
DROP TABLE problem_save;
10
DROP TABLE problem_attempt;
11
DROP TABLE worksheet_problem;
15
CREATE TABLE exercise (
16
identifier TEXT PRIMARY KEY,
25
CREATE TABLE worksheet (
26
worksheetid SERIAL PRIMARY KEY,
27
offeringid INT4 REFERENCES offering (offeringid) NOT NULL,
28
identifier TEXT NOT NULL,
31
assessable BOOLEAN NOT NULL,
34
UNIQUE (offeringid, identifier)
37
CREATE TABLE worksheet_exercise (
38
ws_ex_id SERIAL PRIMARY KEY,
39
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
40
exerciseid TEXT REFERENCES exercise (identifier) NOT NULL,
42
active BOOLEAN NOT NULL DEFAULT true,
43
optional BOOLEAN NOT NULL,
44
UNIQUE (worksheetid, exerciseid)
47
CREATE TABLE exercise_attempt (
48
loginid INT4 REFERENCES login (loginid) NOT NULL,
49
ws_ex_id INT4 REFERENCES worksheet_exercise (ws_ex_id) NOT NULL,
50
date TIMESTAMP NOT NULL,
51
attempt TEXT NOT NULL,
52
complete BOOLEAN NOT NULL,
53
active BOOLEAN NOT NULL DEFAULT true,
54
PRIMARY KEY (loginid, ws_ex_id, date)
57
CREATE TABLE exercise_save (
58
loginid INT4 REFERENCES login (loginid) NOT NULL,
59
ws_ex_id INT4 REFERENCES worksheet_exercise (ws_ex_id) NOT NULL,
60
date TIMESTAMP NOT NULL,
62
PRIMARY KEY (loginid, ws_ex_id)
65
CREATE TABLE test_suite (
66
suiteid SERIAL PRIMARY KEY,
67
exerciseid TEXT REFERENCES exercise (identifier) NOT NULL,
74
CREATE TABLE test_case (
75
testid SERIAL PRIMARY KEY,
76
suiteid INT4 REFERENCES test_suite (suiteid) NOT NULL,
83
CREATE TABLE suite_variable (
84
varid SERIAL PRIMARY KEY,
85
suiteid INT4 REFERENCES test_suite (suiteid) NOT NULL,
88
var_type TEXT NOT NULL,
92
CREATE TABLE test_case_part (
93
partid SERIAL PRIMARY KEY,
94
testid INT4 REFERENCES test_case (testid) NOT NULL,
95
part_type TEXT NOT NULL,