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