17
17
DROP TABLE problem_tag;
18
18
DROP TABLE problem_test_case;
19
19
DROP TABLE problem_prerequisite;
20
TRUNCATE worksheet_problem, worksheet;
22
ALTER TABLE problem_attempt DROP CONSTRAINT problem_attempt_problemid_fkey;
23
ALTER TABLE problem_save DROP CONSTRAINT problem_save_problemid_fkey;
24
ALTER TABLE worksheet_problem DROP CONSTRAINT worksheet_problem_problemid_fkey;
26
ALTER TABLE problem ADD COLUMN name TEXT;
27
ALTER TABLE problem ADD COLUMN description TEXT;
28
ALTER TABLE problem ADD COLUMN partial TEXT;
29
ALTER TABLE problem ADD COLUMN solution TEXT;
30
ALTER TABLE problem ADD COLUMN include TEXT;
31
ALTER TABLE problem ADD COLUMN num_rows INT4;
32
ALTER TABLE problem DROP COLUMN spec;
33
ALTER TABLE problem DROP COLUMN problemid;
35
ALTER TABLE problem_attempt ADD COLUMN worksheetid INT4 REFERENCES worksheet (worksheetid);
36
ALTER TABLE problem_attempt DROP COLUMN problemid;
37
ALTER TABLE problem_attempt ADD COLUMN problemid TEXT REFERENCES problem (identifier);
39
ALTER TABLE problem_save ADD COLUMN worksheetid INT4 REFERENCES worksheet (worksheetid);
40
ALTER TABLE problem_save DROP COLUMN problemid;
41
ALTER TABLE problem_save ADD COLUMN problemid TEXT references problem (identifier);
43
ALTER TABLE worksheet_problem DROP COLUMN problemid;
44
ALTER TABLE worksheet_problem ADD COLUMN problemid TEXT REFERENCES problem (identifier);
20
DROP TABLE problem_save;
21
DROP TABLE problem_attempt;
22
DROP TABLE worksheet_problem;
26
CREATE TABLE problem (
27
identifier TEXT PRIMARY KEY,
36
CREATE TABLE worksheet (
37
worksheetid SERIAL PRIMARY KEY,
38
offeringid INT4 REFERENCES offering (offeringid) NOT NULL,
39
identifier VARCHAR NOT NULL,
42
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)
52
CREATE TABLE problem_attempt (
53
problemid TEXT REFERENCES problem (identifier) NOT NULL,
54
loginid INT4 REFERENCES login (loginid) NOT NULL,
55
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
56
date TIMESTAMP NOT NULL,
57
attempt VARCHAR NOT NULL,
58
complete BOOLEAN NOT NULL,
59
active BOOLEAN NOT NULL DEFAULT true,
60
PRIMARY KEY (problemid,loginid,worksheetid,date)
63
CREATE TABLE problem_save (
64
problemid TEXT REFERENCES problem (identifier) NOT NULL,
65
loginid INT4 REFERENCES login (loginid) NOT NULL,
66
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
67
date TIMESTAMP NOT NULL,
69
PRIMARY KEY (problemid,loginid, worksheetid)
46
72
CREATE TABLE test_suite (
47
suiteid SERIAL UNIQUE NOT NULL,
73
suiteid SERIAL PRIMARY KEY,
48
74
problemid TEXT REFERENCES problem (identifier) NOT NULL,
51
PRIMARY KEY (problemid, suiteid)
54
81
CREATE TABLE test_case (
55
testid SERIAL UNIQUE NOT NULL,
82
testid SERIAL PRIMARY KEY,
83
suiteid INT4 REFERENCES test_suite (suiteid) NOT NULL,
90
CREATE TABLE suite_variables (
91
varid SERIAL PRIMARY KEY,
56
92
suiteid INT4 REFERENCES test_suite (suiteid) NOT NULL,
64
PRIMARY KEY (testid, suiteid)
67
ALTER TABLE worksheet ADD COLUMN offeringid INT4 REFERENCES offering (offeringid) NOT NULL;
95
var_type TEXT NOT NULL,
99
CREATE TABLE test_case_parts (
100
partid SERIAL PRIMARY KEY,
101
testid INT4 REFERENCES test_case (testid) NOT NULL,
102
part_type TEXT NOT NULL,