203
--TODO: Link worksheets to offerings
204
203
CREATE TABLE worksheet (
205
worksheetid SERIAL PRIMARY KEY NOT NULL,
206
subject VARCHAR NOT NULL,
207
offeringid INT4 REFERENCES offering (offeringid) NOT NULL,
204
worksheetid SERIAL PRIMARY KEY,
205
offeringid INT4 REFERENCES offering (offeringid) NOT NULL,
208
206
identifier VARCHAR NOT NULL,
209
207
assessable BOOLEAN,
211
UNIQUE (subject, identifier)
209
UNIQUE (offeringid, identifier)
214
212
CREATE TABLE worksheet_problem (
221
219
CREATE TABLE problem_attempt (
222
problemid VARCHAR REFERENCES problem (identifier) NOT NULL,
220
problemid TEXT REFERENCES problem (identifier) NOT NULL,
223
221
loginid INT4 REFERENCES login (loginid) NOT NULL,
224
222
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
225
223
date TIMESTAMP NOT NULL,
226
224
attempt VARCHAR NOT NULL,
227
225
complete BOOLEAN NOT NULL,
228
226
active BOOLEAN NOT NULL DEFAULT true,
229
PRIMARY KEY (problemid,loginid,date)
227
PRIMARY KEY (problemid,loginid,worksheetid,date)
232
230
CREATE TABLE problem_save (
233
problemid INT4 REFERENCES problem (problemid) NOT NULL,
231
problemid TEXT REFERENCES problem (identifier) NOT NULL,
234
232
loginid INT4 REFERENCES login (loginid) NOT NULL,
235
233
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
236
234
date TIMESTAMP NOT NULL,
237
text VARCHAR NOT NULL,
238
PRIMARY KEY (problemid,loginid)
236
PRIMARY KEY (problemid,loginid, worksheetid)
241
CREATE INDEX problem_attempt_index ON problem_attempt (problemid, loginid);
243
239
CREATE TABLE test_suite (
244
suiteid SERIAL NOT NULL,
240
suiteid SERIAL PRIMARY KEY,
245
241
problemid TEXT REFERENCES problem (identifier) NOT NULL,
246
242
description TEXT,
248
PRIMARY KEY (problemid, suiteid)
251
248
CREATE TABLE test_case (
252
testid SERIAL NOT NULL,
249
testid SERIAL PRIMARY KEY,
250
suiteid INT4 REFERENCES test_suite (suiteid) NOT NULL,
257
CREATE TABLE suite_variables (
258
varid SERIAL PRIMARY KEY,
253
259
suiteid INT4 REFERENCES test_suite (suiteid) NOT NULL,
261
PRIMARY KEY (testid, suiteid)
262
var_type TEXT NOT NULL,
266
CREATE TABLE test_case_parts (
267
partid SERIAL PRIMARY KEY,
268
testid INT4 REFERENCES test_case (testid) NOT NULL,
269
part_type TEXT NOT NULL,