354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
1 |
CREATE TABLE login ( |
446
by drtomc
users.sql: constrain the rolenm to be from a given set of roles. |
2 |
loginid SERIAL PRIMARY KEY NOT NULL, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
3 |
login VARCHAR UNIQUE NOT NULL, |
446
by drtomc
users.sql: constrain the rolenm to be from a given set of roles. |
4 |
passhash VARCHAR, |
475
by mattgiuca
Commited some earlier changes to users.sql (not committed earlier due to |
5 |
state VARCHAR NOT NULL CHECK (state in ('no_agreement', 'pending', |
6 |
'enabled', 'disabled')), |
|
533
by mattgiuca
auth/authenticate: Much done! |
7 |
rolenm VARCHAR NOT NULL CHECK (rolenm in ('anyone', 'student', |
8 |
'marker', 'tutor', |
|
9 |
'lecturer', 'admin')), |
|
415
by drtomc
userdb: added a unixid field to store the uid of the user. |
10 |
unixid INT UNIQUE NOT NULL, -- unix user id |
475
by mattgiuca
Commited some earlier changes to users.sql (not committed earlier due to |
11 |
nick VARCHAR NOT NULL, |
12 |
pass_exp TIMESTAMP, |
|
13 |
acct_exp TIMESTAMP, |
|
14 |
last_login TIMESTAMP, |
|
522
by drtomc
Add quite a lot of stuff to get usrmgt happening. |
15 |
svn_pass VARCHAR, |
462
by mattgiuca
userdb/users.sql: Added email field to login. |
16 |
email VARCHAR, |
446
by drtomc
users.sql: constrain the rolenm to be from a given set of roles. |
17 |
fullname VARCHAR NOT NULL, |
631
by mattgiuca
users.sql: Added "settings" field to the login table. |
18 |
studentid VARCHAR, -- may be null |
19 |
settings VARCHAR |
|
25
by drtomc
A bit more work on the userdb stuff. |
20 |
);
|
21 |
||
353
by drtomc
Start addressing sb's suggestions. |
22 |
CREATE TABLE offering ( |
324
by drtomc
Should all be okay now. |
23 |
offeringid SERIAL PRIMARY KEY NOT NULL, |
24 |
subj_name VARCHAR NOT NULL, |
|
25 |
subj_code VARCHAR NOT NULL, |
|
26 |
year CHAR(4) NOT NULL, |
|
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
27 |
semester CHAR(1) NOT NULL, |
28 |
url VARCHAR |
|
324
by drtomc
Should all be okay now. |
29 |
);
|
30 |
||
355
by drtomc
Fix a few typos and glitches to actually create the ivle database. |
31 |
CREATE TABLE project ( |
32 |
projectid SERIAL PRIMARY KEY NOT NULL, |
|
33 |
synopsis VARCHAR, |
|
34 |
url VARCHAR, |
|
35 |
offeringid INT4 REFERENCES offering (offeringid) NOT NULL, |
|
36 |
deadline TIMESTAMP |
|
37 |
);
|
|
38 |
||
39 |
CREATE TABLE project_group ( |
|
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
40 |
groupnm VARCHAR NOT NULL, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
41 |
groupid SERIAL PRIMARY KEY NOT NULL, |
353
by drtomc
Start addressing sb's suggestions. |
42 |
offeringid INT4 REFERENCES offering (offeringid), |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
43 |
nick VARCHAR, |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
44 |
createdby INT4 REFERENCES login (loginid) NOT NULL, |
45 |
epoch TIMESTAMP NOT NULL, |
|
319
by drtomc
Partial correctness for the user database schema. A few bits and pieces to go. |
46 |
UNIQUE (offeringid, groupnm) |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
47 |
);
|
48 |
||
353
by drtomc
Start addressing sb's suggestions. |
49 |
CREATE TABLE group_invitation ( |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
50 |
loginid INT4 REFERENCES login (loginid) NOT NULL, |
355
by drtomc
Fix a few typos and glitches to actually create the ivle database. |
51 |
groupid INT4 REFERENCES project_group (groupid) NOT NULL, |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
52 |
inviter INT4 REFERENCES login (loginid) NOT NULL, |
53 |
invited TIMESTAMP NOT NULL, |
|
54 |
accepted TIMESTAMP, |
|
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
55 |
UNIQUE (loginid,groupid) |
25
by drtomc
A bit more work on the userdb stuff. |
56 |
);
|
57 |
||
353
by drtomc
Start addressing sb's suggestions. |
58 |
CREATE TABLE group_member ( |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
59 |
loginid INT4 REFERENCES login (loginid), |
355
by drtomc
Fix a few typos and glitches to actually create the ivle database. |
60 |
groupid INT4 REFERENCES project_group (groupid), |
353
by drtomc
Start addressing sb's suggestions. |
61 |
projectid INT4 REFERENCES project (projectid), |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
62 |
UNIQUE (loginid,projectid), |
63 |
PRIMARY KEY (loginid,groupid) |
|
25
by drtomc
A bit more work on the userdb stuff. |
64 |
);
|
65 |
||
66 |
CREATE TABLE enrolment ( |
|
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
67 |
loginid INT4 REFERENCES login (loginid), |
353
by drtomc
Start addressing sb's suggestions. |
68 |
offeringid INT4 REFERENCES offering (offeringid), |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
69 |
result INT, |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
70 |
special_result VARCHAR, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
71 |
supp_result INT, |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
72 |
special_supp_result VARCHAR, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
73 |
notes VARCHAR, |
74 |
PRIMARY KEY (loginid,offeringid) |
|
25
by drtomc
A bit more work on the userdb stuff. |
75 |
);
|
76 |
||
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
77 |
CREATE TABLE assessed ( |
78 |
assessedid SERIAL PRIMARY KEY NOT NULL, |
|
79 |
loginid INT4 REFERENCES login (loginid), |
|
355
by drtomc
Fix a few typos and glitches to actually create the ivle database. |
80 |
groupid INT4 REFERENCES project_group (groupid), |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
81 |
-- exactly one of loginid and groupid must be non-null
|
82 |
CHECK ((loginid IS NOT NULL AND groupid IS NULL) |
|
83 |
OR (loginid IS NULL AND groupid IS NOT NULL)) |
|
84 |
);
|
|
85 |
||
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
86 |
CREATE TABLE project_extension ( |
391
by drtomc
Fix a couple of typos. |
87 |
assessedid INT4 REFERENCES assessed (assessedid) NOT NULL, |
353
by drtomc
Start addressing sb's suggestions. |
88 |
projectid INT4 REFERENCES project (projectid) NOT NULL, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
89 |
deadline TIMESTAMP NOT NULL, |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
90 |
approver INT4 REFERENCES login (loginid) NOT NULL, |
91 |
notes VARCHAR |
|
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
92 |
);
|
93 |
||
665
by drtomc
userdb: Add a submission table, as per our discussions. |
94 |
CREATE TABLE project_submission ( |
95 |
assessedid INT4 REFERENCES assessed (assessedid) NOT NULL, |
|
96 |
projectid INT4 REFERENCES project (projectid) NOT NULL, |
|
97 |
path VARCHAR NOT NULL, |
|
98 |
revision INT4 NOT NULL |
|
99 |
);
|
|
100 |
||
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
101 |
CREATE TABLE project_mark ( |
391
by drtomc
Fix a couple of typos. |
102 |
assessedid INT4 REFERENCES assessed (assessedid) NOT NULL, |
353
by drtomc
Start addressing sb's suggestions. |
103 |
projectid INT4 REFERENCES project (projectid) NOT NULL, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
104 |
componentid INT4, |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
105 |
marker INT4 REFERENCES login (loginid) NOT NULL, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
106 |
mark INT, |
107 |
marked TIMESTAMP, |
|
108 |
feedback VARCHAR, |
|
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
109 |
notes VARCHAR |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
110 |
);
|
281
by stevenbird
extensive updates based on data modelling discussion with Tom Conway |
111 |
|
112 |
CREATE TABLE problem ( |
|
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
113 |
problemid SERIAL PRIMARY KEY NOT NULL, |
659
by drtomc
Add a little script for stuffing exercises into the database. |
114 |
identifier VARCHAR UNIQUE NOT NULL, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
115 |
spec VARCHAR |
281
by stevenbird
extensive updates based on data modelling discussion with Tom Conway |
116 |
);
|
117 |
||
725
by mattgiuca
The database now stores a cache of all the worksheets and what problems |
118 |
CREATE TABLE worksheet ( |
119 |
worksheetid SERIAL PRIMARY KEY NOT NULL, |
|
120 |
subject VARCHAR NOT NULL, |
|
121 |
identifier VARCHAR NOT NULL, |
|
122 |
assessable BOOLEAN, |
|
123 |
mtime TIMESTAMP, |
|
124 |
UNIQUE (subject, identifier) |
|
125 |
);
|
|
126 |
||
127 |
CREATE TABLE worksheet_problem ( |
|
128 |
worksheetid INT4 REFERENCES worksheet (worksheetid) NOT NULL, |
|
129 |
problemid INT4 REFERENCES problem (problemid) NOT NULL, |
|
130 |
optional BOOLEAN, |
|
131 |
PRIMARY KEY (worksheetid, problemid) |
|
132 |
);
|
|
133 |
||
353
by drtomc
Start addressing sb's suggestions. |
134 |
CREATE TABLE problem_tag ( |
392
by drtomc
Fix another glitch. |
135 |
problemid INT4 REFERENCES problem (problemid), |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
136 |
tag VARCHAR NOT NULL, |
366
by drtomc
Somehow a couple of changed that address issues sb raised didn't get committed previously. Here they are. |
137 |
description VARCHAR, |
138 |
standard BOOLEAN NOT NULL, |
|
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
139 |
added_by INT4 REFERENCES login (loginid) NOT NULL, |
319
by drtomc
Partial correctness for the user database schema. A few bits and pieces to go. |
140 |
date TIMESTAMP NOT NULL, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
141 |
PRIMARY KEY (problemid,added_by,tag) |
142 |
);
|
|
143 |
||
144 |
CREATE TABLE problem_test_case ( |
|
145 |
problemid INT4 REFERENCES problem (problemid) NOT NULL, |
|
146 |
testcaseid SERIAL UNIQUE NOT NULL, |
|
147 |
testcase VARCHAR, |
|
148 |
description VARCHAR, |
|
149 |
visibility VARCHAR CHECK (visibility in ('public', 'protected', 'private')) |
|
150 |
);
|
|
151 |
||
353
by drtomc
Start addressing sb's suggestions. |
152 |
CREATE TABLE problem_test_case_tag ( |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
153 |
testcaseid INT4 REFERENCES problem_test_case (testcaseid) NOT NULL, |
154 |
tag VARCHAR NOT NULL, |
|
155 |
description VARCHAR, |
|
366
by drtomc
Somehow a couple of changed that address issues sb raised didn't get committed previously. Here they are. |
156 |
standard BOOLEAN NOT NULL, |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
157 |
added_by INT4 REFERENCES login (loginid) NOT NULL, |
319
by drtomc
Partial correctness for the user database schema. A few bits and pieces to go. |
158 |
date TIMESTAMP NOT NULL, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
159 |
PRIMARY KEY (testcaseid,added_by,tag) |
281
by stevenbird
extensive updates based on data modelling discussion with Tom Conway |
160 |
);
|
161 |
||
162 |
CREATE TABLE problem_attempt ( |
|
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
163 |
problemid INT4 REFERENCES problem (problemid) NOT NULL, |
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
164 |
loginid INT4 REFERENCES login (loginid) NOT NULL, |
319
by drtomc
Partial correctness for the user database schema. A few bits and pieces to go. |
165 |
date TIMESTAMP NOT NULL, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
166 |
attempt VARCHAR NOT NULL, |
167 |
complete BOOLEAN NOT NULL, |
|
319
by drtomc
Partial correctness for the user database schema. A few bits and pieces to go. |
168 |
PRIMARY KEY (problemid,loginid,date) |
281
by stevenbird
extensive updates based on data modelling discussion with Tom Conway |
169 |
);
|
170 |
||
697
by mattgiuca
users.sql: Added database table problem_save, for storing exercises that are |
171 |
CREATE TABLE problem_save ( |
172 |
problemid INT4 REFERENCES problem (problemid) NOT NULL, |
|
173 |
loginid INT4 REFERENCES login (loginid) NOT NULL, |
|
174 |
date TIMESTAMP NOT NULL, |
|
175 |
text VARCHAR NOT NULL, |
|
176 |
PRIMARY KEY (problemid,loginid) |
|
177 |
);
|
|
178 |
||
324
by drtomc
Should all be okay now. |
179 |
CREATE INDEX problem_attempt_index ON problem_attempt (problemid, loginid); |
281
by stevenbird
extensive updates based on data modelling discussion with Tom Conway |
180 |
|
181 |
CREATE TABLE problem_attempt_breakdown ( |
|
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
182 |
problemid INT4 REFERENCES problem (problemid) NOT NULL, |
183 |
testcaseid INT4 REFERENCES problem_test_case (testcaseid) NOT NULL, |
|
354
by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-) |
184 |
loginid INT4 REFERENCES login (loginid) NOT NULL, |
319
by drtomc
Partial correctness for the user database schema. A few bits and pieces to go. |
185 |
date TIMESTAMP NOT NULL, |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
186 |
result BOOLEAN |
187 |
);
|
|
188 |
||
353
by drtomc
Start addressing sb's suggestions. |
189 |
CREATE TABLE problem_prerequisite ( |
296
by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb. |
190 |
parent INT4 REFERENCES problem (problemid) NOT NULL, |
191 |
child INT4 REFERENCES problem (problemid) NOT NULL, |
|
192 |
PRIMARY KEY (parent,child) |
|
193 |
);
|
|
194 |