~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,
319 by drtomc
Partial correctness for the user database schema. A few bits and pieces to go.
18
    studentid   VARCHAR -- may be null
25 by drtomc
A bit more work on the userdb stuff.
19
);
20
353 by drtomc
Start addressing sb's suggestions.
21
CREATE TABLE offering (
324 by drtomc
Should all be okay now.
22
    offeringid  SERIAL PRIMARY KEY NOT NULL,
23
    subj_name   VARCHAR NOT NULL,
24
    subj_code   VARCHAR NOT NULL,
25
    year        CHAR(4) NOT NULL,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
26
    semester    CHAR(1) NOT NULL,
27
    url         VARCHAR
324 by drtomc
Should all be okay now.
28
);
29
355 by drtomc
Fix a few typos and glitches to actually create the ivle database.
30
CREATE TABLE project (
31
    projectid   SERIAL PRIMARY KEY NOT NULL,
32
    synopsis    VARCHAR,
33
    url         VARCHAR,
34
    offeringid  INT4 REFERENCES offering (offeringid) NOT NULL,
35
    deadline    TIMESTAMP
36
);
37
38
CREATE TABLE project_group (
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
39
    groupnm     VARCHAR NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
40
    groupid     SERIAL PRIMARY KEY NOT NULL,
353 by drtomc
Start addressing sb's suggestions.
41
    offeringid  INT4 REFERENCES offering (offeringid),
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
42
    nick        VARCHAR,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
43
    createdby   INT4 REFERENCES login (loginid) NOT NULL,
44
    epoch       TIMESTAMP NOT NULL,
319 by drtomc
Partial correctness for the user database schema. A few bits and pieces to go.
45
    UNIQUE (offeringid, groupnm)
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
46
);
47
353 by drtomc
Start addressing sb's suggestions.
48
CREATE TABLE group_invitation (
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
49
    loginid     INT4 REFERENCES login (loginid) NOT NULL,
355 by drtomc
Fix a few typos and glitches to actually create the ivle database.
50
    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. :-)
51
    inviter     INT4 REFERENCES login (loginid) NOT NULL,
52
    invited     TIMESTAMP NOT NULL,
53
    accepted    TIMESTAMP,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
54
    UNIQUE (loginid,groupid)
25 by drtomc
A bit more work on the userdb stuff.
55
);
56
353 by drtomc
Start addressing sb's suggestions.
57
CREATE TABLE group_member (
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
58
    loginid     INT4 REFERENCES login (loginid),
355 by drtomc
Fix a few typos and glitches to actually create the ivle database.
59
    groupid     INT4 REFERENCES project_group (groupid),
353 by drtomc
Start addressing sb's suggestions.
60
    projectid   INT4 REFERENCES project (projectid),
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
61
    UNIQUE (loginid,projectid),
62
    PRIMARY KEY (loginid,groupid)
25 by drtomc
A bit more work on the userdb stuff.
63
);
64
65
CREATE TABLE enrolment (
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
66
    loginid     INT4 REFERENCES login (loginid),
353 by drtomc
Start addressing sb's suggestions.
67
    offeringid  INT4 REFERENCES offering (offeringid),
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
68
    result      INT,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
69
    special_result VARCHAR,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
70
    supp_result INT,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
71
    special_supp_result VARCHAR,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
72
    notes       VARCHAR,
73
    PRIMARY KEY (loginid,offeringid)
25 by drtomc
A bit more work on the userdb stuff.
74
);
75
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
76
CREATE TABLE assessed (
77
    assessedid  SERIAL PRIMARY KEY NOT NULL,
78
    loginid     INT4 REFERENCES login (loginid),
355 by drtomc
Fix a few typos and glitches to actually create the ivle database.
79
    groupid     INT4 REFERENCES project_group (groupid),
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
80
    -- exactly one of loginid and groupid must be non-null
81
    CHECK ((loginid IS NOT NULL AND groupid IS NULL)
82
        OR (loginid IS NULL AND groupid IS NOT NULL))
83
);
84
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
85
CREATE TABLE project_extension (
391 by drtomc
Fix a couple of typos.
86
    assessedid  INT4 REFERENCES assessed (assessedid) NOT NULL,
353 by drtomc
Start addressing sb's suggestions.
87
    projectid   INT4 REFERENCES project (projectid) NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
88
    deadline    TIMESTAMP NOT NULL,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
89
    approver    INT4 REFERENCES login (loginid) NOT NULL,
90
    notes       VARCHAR
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
91
);
92
93
CREATE TABLE project_mark (
391 by drtomc
Fix a couple of typos.
94
    assessedid  INT4 REFERENCES assessed (assessedid) NOT NULL,
353 by drtomc
Start addressing sb's suggestions.
95
    projectid   INT4 REFERENCES project (projectid) NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
96
    componentid INT4,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
97
    marker      INT4 REFERENCES login (loginid) NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
98
    mark        INT,
99
    marked      TIMESTAMP,
100
    feedback    VARCHAR,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
101
    notes       VARCHAR
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
102
);
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
103
104
CREATE TABLE problem (
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
105
    problemid   SERIAL PRIMARY KEY NOT NULL,
106
    spec        VARCHAR
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
107
);
108
353 by drtomc
Start addressing sb's suggestions.
109
CREATE TABLE problem_tag (
392 by drtomc
Fix another glitch.
110
    problemid   INT4 REFERENCES problem (problemid),
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
111
    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.
112
    description VARCHAR,
113
    standard    BOOLEAN NOT NULL,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
114
    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.
115
    date        TIMESTAMP NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
116
    PRIMARY KEY (problemid,added_by,tag)
117
);
118
119
CREATE TABLE problem_test_case (
120
    problemid   INT4 REFERENCES problem (problemid) NOT NULL,
121
    testcaseid  SERIAL UNIQUE NOT NULL,
122
    testcase    VARCHAR,
123
    description VARCHAR,
124
    visibility  VARCHAR CHECK (visibility in ('public', 'protected', 'private'))
125
);
126
353 by drtomc
Start addressing sb's suggestions.
127
CREATE TABLE problem_test_case_tag (
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
128
    testcaseid  INT4 REFERENCES problem_test_case (testcaseid) NOT NULL,
129
    tag         VARCHAR NOT NULL,
130
    description VARCHAR,
366 by drtomc
Somehow a couple of changed that address issues sb raised didn't get committed previously. Here they are.
131
    standard    BOOLEAN NOT NULL,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
132
    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.
133
    date        TIMESTAMP NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
134
    PRIMARY KEY (testcaseid,added_by,tag)
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
135
);
136
137
CREATE TABLE problem_attempt (
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
138
    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. :-)
139
    loginid     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
    attempt     VARCHAR NOT NULL,
142
    complete    BOOLEAN NOT NULL,
319 by drtomc
Partial correctness for the user database schema. A few bits and pieces to go.
143
    PRIMARY KEY (problemid,loginid,date)
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
144
);
145
324 by drtomc
Should all be okay now.
146
CREATE INDEX problem_attempt_index ON problem_attempt (problemid, loginid);
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
147
148
CREATE TABLE problem_attempt_breakdown (
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
149
    problemid   INT4 REFERENCES problem (problemid) NOT NULL,
150
    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. :-)
151
    loginid     INT4 REFERENCES login (loginid) NOT NULL,
319 by drtomc
Partial correctness for the user database schema. A few bits and pieces to go.
152
    date        TIMESTAMP NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
153
    result      BOOLEAN
154
);
155
353 by drtomc
Start addressing sb's suggestions.
156
CREATE TABLE problem_prerequisite (
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
157
    parent      INT4 REFERENCES problem (problemid) NOT NULL,
158
    child       INT4 REFERENCES problem (problemid) NOT NULL,
159
    PRIMARY KEY (parent,child)
160
);
161