~azzar1/unity/add-show-desktop-key

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