2
login VARCHAR UNIQUE NOT NULL,
2
3
loginid SERIAL PRIMARY KEY NOT NULL,
3
login VARCHAR UNIQUE NOT NULL,
4
unixid INT UNIQUE NOT NULL, -- unix user id
5
state VARCHAR NOT NULL CHECK (state in ('no_agreement', 'pending',
6
'enabled', 'disabled')),
7
rolenm VARCHAR NOT NULL CHECK (rolenm in ('anyone', 'student',
10
unixid INT UNIQUE NOT NULL, -- unix user id
11
nick VARCHAR NOT NULL,
17
fullname VARCHAR NOT NULL,
18
studentid VARCHAR, -- may be null
22
CREATE TABLE subject (
23
subjectid SERIAL PRIMARY KEY NOT NULL,
24
subj_code VARCHAR UNIQUE NOT NULL,
25
subj_name VARCHAR NOT NULL,
26
subj_short_name VARCHAR, -- may be null
9
studentid VARCHAR -- may be null
30
12
CREATE TABLE offering (
31
13
offeringid SERIAL PRIMARY KEY NOT NULL,
32
subject INT4 REFERENCES subject (subjectid) NOT NULL,
14
subj_name VARCHAR NOT NULL,
15
subj_code VARCHAR NOT NULL,
33
16
year CHAR(4) NOT NULL,
34
17
semester CHAR(1) NOT NULL,
35
UNIQUE (subject, year, semester)
38
21
CREATE TABLE project (
101
CREATE TABLE project_submission (
102
assessedid INT4 REFERENCES assessed (assessedid) NOT NULL,
103
projectid INT4 REFERENCES project (projectid) NOT NULL,
104
path VARCHAR NOT NULL,
105
revision INT4 NOT NULL
108
84
CREATE TABLE project_mark (
109
85
assessedid INT4 REFERENCES assessed (assessedid) NOT NULL,
110
86
projectid INT4 REFERENCES project (projectid) NOT NULL,
119
95
CREATE TABLE problem (
120
96
problemid SERIAL PRIMARY KEY NOT NULL,
121
identifier VARCHAR UNIQUE NOT NULL,
125
CREATE TABLE worksheet (
126
worksheetid SERIAL PRIMARY KEY NOT NULL,
127
subject VARCHAR NOT NULL,
128
identifier VARCHAR NOT NULL,
131
UNIQUE (subject, identifier)
134
CREATE TABLE worksheet_problem (
135
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL,
136
problemid INT4 REFERENCES problem (problemid) NOT NULL,
138
PRIMARY KEY (worksheetid, problemid)
141
100
CREATE TABLE problem_tag (
142
101
problemid INT4 REFERENCES problem (problemid),
143
102
tag VARCHAR NOT NULL,
175
134
PRIMARY KEY (problemid,loginid,date)
178
CREATE TABLE problem_save (
179
problemid INT4 REFERENCES problem (problemid) NOT NULL,
180
loginid INT4 REFERENCES login (loginid) NOT NULL,
181
date TIMESTAMP NOT NULL,
182
text VARCHAR NOT NULL,
183
PRIMARY KEY (problemid,loginid)
186
137
CREATE INDEX problem_attempt_index ON problem_attempt (problemid, loginid);
188
139
CREATE TABLE problem_attempt_breakdown (