2
login VARCHAR UNIQUE NOT NULL,
2
3
loginid SERIAL PRIMARY KEY NOT NULL,
3
login VARCHAR UNIQUE NOT NULL,
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
6
studentid VARCHAR -- may be null
30
9
CREATE TABLE offering (
31
10
offeringid SERIAL PRIMARY KEY NOT NULL,
32
subject INT4 REFERENCES subject (subjectid) NOT NULL,
11
subj_name VARCHAR NOT NULL,
12
subj_code VARCHAR NOT NULL,
33
13
year CHAR(4) NOT NULL,
34
14
semester CHAR(1) NOT NULL,
35
UNIQUE (subject, year, semester)
38
18
CREATE TABLE project (
81
61
PRIMARY KEY (loginid,offeringid)
64
CREATE TABLE ivle_role (
65
loginid INT4 PRIMARY KEY REFERENCES login (loginid),
84
69
CREATE TABLE assessed (
85
70
assessedid SERIAL PRIMARY KEY NOT NULL,
86
71
loginid INT4 REFERENCES login (loginid),
93
78
CREATE TABLE project_extension (
94
assessedid INT4 REFERENCES assessed (assessedid) NOT NULL,
79
assessedid INT4 REFERENCES assessed (assesedid) NOT NULL,
95
80
projectid INT4 REFERENCES project (projectid) NOT NULL,
96
81
deadline TIMESTAMP NOT NULL,
97
82
approver INT4 REFERENCES login (loginid) NOT NULL,
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
86
CREATE TABLE project_mark (
109
assessedid INT4 REFERENCES assessed (assessedid) NOT NULL,
87
assessedid INT4 REFERENCES assessed (assesedid) NOT NULL,
110
88
projectid INT4 REFERENCES project (projectid) NOT NULL,
112
90
marker INT4 REFERENCES login (loginid) NOT NULL,
119
97
CREATE TABLE problem (
120
98
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
102
CREATE TABLE problem_tag (
142
problemid INT4 REFERENCES problem (problemid),
103
problemid INT4 REFERENCES tutorial_problem (problemid),
143
104
tag VARCHAR NOT NULL,
145
standard BOOLEAN NOT NULL,
146
105
added_by INT4 REFERENCES login (loginid) NOT NULL,
147
106
date TIMESTAMP NOT NULL,
148
107
PRIMARY KEY (problemid,added_by,tag)
160
119
testcaseid INT4 REFERENCES problem_test_case (testcaseid) NOT NULL,
161
120
tag VARCHAR NOT NULL,
162
121
description VARCHAR,
163
standard BOOLEAN NOT NULL,
164
122
added_by INT4 REFERENCES login (loginid) NOT NULL,
165
123
date TIMESTAMP NOT NULL,
166
124
PRIMARY KEY (testcaseid,added_by,tag)
175
133
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
136
CREATE INDEX problem_attempt_index ON problem_attempt (problemid, loginid);
188
138
CREATE TABLE problem_attempt_breakdown (