226
227
attempt VARCHAR NOT NULL,
227
228
complete BOOLEAN NOT NULL,
228
229
active BOOLEAN NOT NULL DEFAULT true,
229
PRIMARY KEY (problemid,loginid,date)
230
PRIMARY KEY (problemid,loginid,worksheetid,date)
232
233
CREATE TABLE problem_save (
233
problemid INT4 REFERENCES problem (problemid) NOT NULL,
234
problemid TEXT REFERENCES problem (identifier) NOT NULL,
234
235
loginid INT4 REFERENCES login (loginid) NOT NULL,
235
236
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
236
237
date TIMESTAMP NOT NULL,
237
238
text VARCHAR NOT NULL,
238
PRIMARY KEY (problemid,loginid)
239
PRIMARY KEY (problemid,loginid, worksheetid)
241
CREATE INDEX problem_attempt_index ON problem_attempt (problemid, loginid);
243
242
-- TABLES FOR EXERCISES IN DATABASE --
244
243
CREATE TABLE test_suite (
245
suiteid SERIAL NOT NULL,
244
suiteid SERIAL UNIQUE NOT NULL,
246
245
problemid TEXT REFERENCES problem (identifier) NOT NULL,
247
246
description TEXT,