36
36
CREATE TABLE worksheet (
37
37
worksheetid SERIAL PRIMARY KEY,
38
38
offeringid INT4 REFERENCES offering (offeringid) NOT NULL,
39
identifier TEXT NOT NULL,
42
assessable BOOLEAN NOT NULL,
39
identifier VARCHAR NOT NULL,
45
42
UNIQUE (offeringid, identifier)
48
CREATE TABLE worksheet_exercise (
49
ws_ex_id SERIAL PRIMARY KEY,
50
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
51
exerciseid TEXT REFERENCES exercise (identifier) NOT NULL,
53
active BOOLEAN NOT NULL DEFAULT true,
54
optional BOOLEAN NOT NULL,
55
UNIQUE (worksheetid, exerciseid)
45
CREATE TABLE worksheet_problem (
46
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
47
problemid TEXT REFERENCES problem (identifier) NOT NULL,
49
PRIMARY KEY (worksheetid, problemid)
58
CREATE TABLE exercise_attempt (
52
CREATE TABLE problem_attempt (
53
problemid TEXT REFERENCES problem (identifier) NOT NULL,
59
54
loginid INT4 REFERENCES login (loginid) NOT NULL,
60
ws_ex_id INT4 REFERENCES worksheet_exercise (ws_ex_id) NOT NULL,
55
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
61
56
date TIMESTAMP NOT NULL,
62
attempt TEXT NOT NULL,
57
attempt VARCHAR NOT NULL,
63
58
complete BOOLEAN NOT NULL,
64
59
active BOOLEAN NOT NULL DEFAULT true,
65
PRIMARY KEY (loginid, ws_ex_id, date)
60
PRIMARY KEY (problemid,loginid,worksheetid,date)
68
CREATE TABLE exercise_save (
63
CREATE TABLE problem_save (
64
problemid TEXT REFERENCES problem (identifier) NOT NULL,
69
65
loginid INT4 REFERENCES login (loginid) NOT NULL,
70
ws_ex_id INT4 REFERENCES worksheet_exercise (ws_ex_id) NOT NULL,
66
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
71
67
date TIMESTAMP NOT NULL,
72
68
text TEXT NOT NULL,
73
PRIMARY KEY (loginid, ws_ex_id)
69
PRIMARY KEY (problemid,loginid, worksheetid)
76
72
CREATE TABLE test_suite (
77
73
suiteid SERIAL PRIMARY KEY,
78
exerciseid TEXT REFERENCES exercise (identifier) NOT NULL,
74
problemid TEXT REFERENCES problem (identifier) NOT NULL,