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