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

1099.1.142 by Nick Chadwick
Fixed a slight issue with the migration and the users.sql files not
1
BEGIN;
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
2
3
-- Check that the provided name is sane for use in URLs.
4
CREATE OR REPLACE FUNCTION valid_url_name(name text) RETURNS boolean AS 
5
$$
6
    BEGIN
1606.1.15 by William Grant
Permit underscores in all names.
7
        RETURN name ~ E'^[a-z0-9][a-z0-9_\+\.\-]*$';
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
8
    END;
9
$$ LANGUAGE 'plpgsql';
10
11
-- Just like valid_url_name, except that @ is permitted (so we can use a
12
-- reasonable subset of email addresses as usernames).
13
CREATE OR REPLACE FUNCTION valid_login_name(name text) RETURNS boolean AS 
14
$$
15
    BEGIN
1606.1.15 by William Grant
Permit underscores in all names.
16
        RETURN name ~ E'^[a-z0-9][a-z0-9@_\+\.\-]*$';
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
17
    END;
18
$$ LANGUAGE 'plpgsql';
19
936 by wagrant
userdb: Add the changes from migration 20080718-01 to users.sql. It was
20
CREATE SEQUENCE login_unixid_seq MINVALUE 1000 MAXVALUE 29999 START WITH 5000;
21
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
22
CREATE TABLE login (
446 by drtomc
users.sql: constrain the rolenm to be from a given set of roles.
23
    loginid     SERIAL PRIMARY KEY NOT NULL,
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
24
    login       VARCHAR UNIQUE NOT NULL CHECK (valid_login_name(login)),
446 by drtomc
users.sql: constrain the rolenm to be from a given set of roles.
25
    passhash    VARCHAR,
475 by mattgiuca
Commited some earlier changes to users.sql (not committed earlier due to
26
    state	VARCHAR NOT NULL CHECK (state in ('no_agreement', 'pending',
1080.1.69 by William Grant
userdb: login.state now defaults to 'no_agreement'.
27
                                              'enabled', 'disabled'))
28
                                 DEFAULT 'no_agreement',
1112 by matt.giuca
userdb/users.sql: Fixed two syntax errors. Jeepers!
29
    admin       BOOLEAN NOT NULL DEFAULT false,
936 by wagrant
userdb: Add the changes from migration 20080718-01 to users.sql. It was
30
    unixid      INT UNIQUE DEFAULT nextval('login_unixid_seq') NOT NULL,
475 by mattgiuca
Commited some earlier changes to users.sql (not committed earlier due to
31
    nick        VARCHAR NOT NULL,
32
    pass_exp    TIMESTAMP,
33
    acct_exp    TIMESTAMP,
34
    last_login  TIMESTAMP,
522 by drtomc
Add quite a lot of stuff to get usrmgt happening.
35
    svn_pass    VARCHAR,
462 by mattgiuca
userdb/users.sql: Added email field to login.
36
    email       VARCHAR,
446 by drtomc
users.sql: constrain the rolenm to be from a given set of roles.
37
    fullname    VARCHAR NOT NULL,
631 by mattgiuca
users.sql: Added "settings" field to the login table.
38
    studentid   VARCHAR, -- may be null
39
    settings    VARCHAR
25 by drtomc
A bit more work on the userdb stuff.
40
);
41
935 by wagrant
userdb: Large changes:
42
-- Subjects
43
-- --------
44
816 by mattgiuca
users.sql: Updated database schema; split subject and offering tables.
45
CREATE TABLE subject (
46
    subjectid       SERIAL PRIMARY KEY NOT NULL,
47
    subj_code       VARCHAR UNIQUE NOT NULL,
48
    subj_name       VARCHAR NOT NULL,
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
49
    subj_short_name VARCHAR UNIQUE NOT NULL CHECK (valid_url_name(subj_short_name))
816 by mattgiuca
users.sql: Updated database schema; split subject and offering tables.
50
);
51
935 by wagrant
userdb: Large changes:
52
CREATE TABLE semester (
53
    semesterid  SERIAL PRIMARY KEY NOT NULL,
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
54
    year        CHAR(4) NOT NULL CHECK (valid_url_name(year)),
55
    semester    CHAR(1) NOT NULL CHECK (valid_url_name(semester)),
1112 by matt.giuca
userdb/users.sql: Fixed two syntax errors. Jeepers!
56
    state       TEXT NOT NULL CHECK (state IN ('disabled', 'past',
57
                                    'current', 'future')) DEFAULT 'current',
935 by wagrant
userdb: Large changes:
58
    UNIQUE (year, semester)
59
);
60
353 by drtomc
Start addressing sb's suggestions.
61
CREATE TABLE offering (
324 by drtomc
Should all be okay now.
62
    offeringid  SERIAL PRIMARY KEY NOT NULL,
816 by mattgiuca
users.sql: Updated database schema; split subject and offering tables.
63
    subject     INT4 REFERENCES subject (subjectid) NOT NULL,
935 by wagrant
userdb: Large changes:
64
    semesterid  INTEGER REFERENCES semester (semesterid) NOT NULL,
1451.1.2 by William Grant
Move Subject.url to Offering, and add Offering.description. Show these on the offering index.
65
    description VARCHAR,
66
    url         VARCHAR,
1695.1.1 by William Grant
Add DB patch for mark showing, and worksheet cutoff and publishing.
67
    show_worksheet_marks BOOLEAN NOT NULL DEFAULT false,
68
    worksheet_cutoff TIMESTAMP,
935 by wagrant
userdb: Large changes:
69
    groups_student_permissions  VARCHAR NOT NULL DEFAULT 'none',
70
    CHECK (groups_student_permissions in ('none', 'invite', 'create')),
71
    UNIQUE (subject, semesterid)
72
);
73
74
-- Projects and groups
75
-- -------------------
76
77
CREATE TABLE project_set (
78
    projectsetid  SERIAL PRIMARY KEY NOT NULL,
79
    offeringid    INTEGER REFERENCES offering (offeringid) NOT NULL,
1165.1.45 by William Grant
Remove the NOT NULL and default from project_set.max_students_per_group.
80
    max_students_per_group  INTEGER
324 by drtomc
Should all be okay now.
81
);
82
355 by drtomc
Fix a few typos and glitches to actually create the ivle database.
83
CREATE TABLE project (
84
    projectid   SERIAL PRIMARY KEY NOT NULL,
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
85
    short_name  TEXT NOT NULL CHECK (valid_url_name(short_name)),
1165.1.3 by William Grant
Add NOT NULL name and short_name columns to project.
86
    name        TEXT NOT NULL,
87
    synopsis    TEXT,
88
    url         TEXT,
935 by wagrant
userdb: Large changes:
89
    projectsetid  INTEGER REFERENCES project_set (projectsetid) NOT NULL,
1316.1.1 by David Coles
Set project.deadline to NOT NULL since it is required for submits.
90
    deadline    TIMESTAMP NOT NULL
355 by drtomc
Fix a few typos and glitches to actually create the ivle database.
91
);
92
1165.1.3 by William Grant
Add NOT NULL name and short_name columns to project.
93
CREATE OR REPLACE FUNCTION check_project_namespacing_insertupdate()
94
RETURNS trigger AS '
95
    DECLARE
96
        oid INTEGER;
97
    BEGIN
98
        IF TG_OP = ''UPDATE'' THEN
99
            IF NEW.projectsetid = OLD.projectsetid AND NEW.short_name = OLD.short_name THEN
100
                RETURN NEW;
101
            END IF;
102
        END IF;
103
        SELECT offeringid INTO oid FROM project_set WHERE project_set.projectsetid = NEW.projectsetid;
104
        PERFORM 1 FROM project, project_set
105
        WHERE project_set.offeringid = oid AND
106
              project.projectsetid = project_set.projectsetid AND
107
              project.short_name = NEW.short_name;
108
        IF found THEN
109
            RAISE EXCEPTION ''a project named % already exists in offering ID %'', NEW.short_name, oid;
110
        END IF;
111
        RETURN NEW;
112
    END;
113
' LANGUAGE 'plpgsql';
114
115
CREATE TRIGGER check_project_namespacing
116
    BEFORE INSERT OR UPDATE ON project
117
    FOR EACH ROW EXECUTE PROCEDURE check_project_namespacing_insertupdate();
118
355 by drtomc
Fix a few typos and glitches to actually create the ivle database.
119
CREATE TABLE project_group (
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
120
    groupnm     VARCHAR NOT NULL CHECK (valid_url_name(groupnm)),
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
121
    groupid     SERIAL PRIMARY KEY NOT NULL,
935 by wagrant
userdb: Large changes:
122
    projectsetid  INTEGER REFERENCES project_set (projectsetid) NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
123
    nick        VARCHAR,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
124
    createdby   INT4 REFERENCES login (loginid) NOT NULL,
125
    epoch       TIMESTAMP NOT NULL,
935 by wagrant
userdb: Large changes:
126
    UNIQUE (projectsetid, groupnm)
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
127
);
128
935 by wagrant
userdb: Large changes:
129
CREATE OR REPLACE FUNCTION check_group_namespacing_insertupdate()
130
RETURNS trigger AS '
131
    DECLARE
132
        oid INTEGER;
133
    BEGIN
134
        SELECT offeringid INTO oid FROM project_set WHERE project_set.projectsetid = NEW.projectsetid;
1044 by wagrant
userdb: Properly verify that the group name is unique only within the
135
        PERFORM 1 FROM project_group, project_set WHERE project_set.offeringid = oid AND project_group.projectsetid = project_set.projectsetid AND project_group.groupnm = NEW.groupnm;
935 by wagrant
userdb: Large changes:
136
        IF found THEN
137
            RAISE EXCEPTION ''a project group named % already exists in offering ID %'', NEW.groupnm, oid;
138
        END IF;
139
        RETURN NEW;
140
    END;
141
' LANGUAGE 'plpgsql';
142
143
CREATE TRIGGER check_group_namespacing
144
    BEFORE INSERT OR UPDATE ON project_group
145
    FOR EACH ROW EXECUTE PROCEDURE check_group_namespacing_insertupdate();
146
353 by drtomc
Start addressing sb's suggestions.
147
CREATE TABLE group_invitation (
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
148
    loginid     INT4 REFERENCES login (loginid) NOT NULL,
355 by drtomc
Fix a few typos and glitches to actually create the ivle database.
149
    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. :-)
150
    inviter     INT4 REFERENCES login (loginid) NOT NULL,
151
    invited     TIMESTAMP NOT NULL,
152
    accepted    TIMESTAMP,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
153
    UNIQUE (loginid,groupid)
25 by drtomc
A bit more work on the userdb stuff.
154
);
155
353 by drtomc
Start addressing sb's suggestions.
156
CREATE TABLE group_member (
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
157
    loginid     INT4 REFERENCES login (loginid),
355 by drtomc
Fix a few typos and glitches to actually create the ivle database.
158
    groupid     INT4 REFERENCES project_group (groupid),
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
159
    PRIMARY KEY (loginid,groupid)
25 by drtomc
A bit more work on the userdb stuff.
160
);
161
162
CREATE TABLE enrolment (
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
163
    loginid     INT4 REFERENCES login (loginid),
353 by drtomc
Start addressing sb's suggestions.
164
    offeringid  INT4 REFERENCES offering (offeringid),
1101 by William Grant
Privileges (apart from admin) are now offering-local, not global.
165
    role        TEXT NOT NULL CHECK (role IN ('student', 'tutor',
166
                                              'lecturer')) DEFAULT 'student',
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
167
    result      INT,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
168
    special_result VARCHAR,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
169
    supp_result INT,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
170
    special_supp_result VARCHAR,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
171
    notes       VARCHAR,
935 by wagrant
userdb: Large changes:
172
    active      BOOL NOT NULL DEFAULT true,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
173
    PRIMARY KEY (loginid,offeringid)
25 by drtomc
A bit more work on the userdb stuff.
174
);
175
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
176
CREATE TABLE assessed (
177
    assessedid  SERIAL PRIMARY KEY NOT NULL,
178
    loginid     INT4 REFERENCES login (loginid),
355 by drtomc
Fix a few typos and glitches to actually create the ivle database.
179
    groupid     INT4 REFERENCES project_group (groupid),
915 by mattgiuca
Moved projectid from all tables using assessedid into the assessed table
180
    projectid   INT4 REFERENCES project (projectid) NOT NULL,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
181
    -- exactly one of loginid and groupid must be non-null
182
    CHECK ((loginid IS NOT NULL AND groupid IS NULL)
183
        OR (loginid IS NULL AND groupid IS NOT NULL))
184
);
185
1790 by William Grant
Add unique indices on assessed(loginid, projectid) and assessed(groupid, projectid), where they should have been from the start.
186
-- We must use conditional constraints here -- NULL != NULL.
187
CREATE UNIQUE INDEX assessed_loginid_key ON assessed(loginid, projectid) WHERE loginid IS NOT NULL;
188
CREATE UNIQUE INDEX assessed_groupid_key ON assessed(groupid, projectid) WHERE groupid IS NOT NULL;
189
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
190
CREATE TABLE project_extension (
1165.1.2 by William Grant
Add serial primary keys to project_{extension,submission}.
191
    extensionid SERIAL PRIMARY KEY,
391 by drtomc
Fix a couple of typos.
192
    assessedid  INT4 REFERENCES assessed (assessedid) NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
193
    deadline    TIMESTAMP NOT NULL,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
194
    approver    INT4 REFERENCES login (loginid) NOT NULL,
195
    notes       VARCHAR
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
196
);
197
665 by drtomc
userdb: Add a submission table, as per our discussions.
198
CREATE TABLE project_submission (
1165.1.2 by William Grant
Add serial primary keys to project_{extension,submission}.
199
    submissionid SERIAL PRIMARY KEY,
665 by drtomc
userdb: Add a submission table, as per our discussions.
200
    assessedid  INT4 REFERENCES assessed (assessedid) NOT NULL,
201
    path        VARCHAR NOT NULL,
1165.1.1 by Matt Giuca
users.sql: Added to project_submission: 'date_submitted'.
202
    revision    INT4 NOT NULL,
1165.1.42 by William Grant
Record who submitted each submission.
203
    date_submitted TIMESTAMP NOT NULL,
204
    submitter   INT4 REFERENCES login (loginid) NOT NULL
665 by drtomc
userdb: Add a submission table, as per our discussions.
205
);
206
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
207
CREATE TABLE project_mark (
391 by drtomc
Fix a couple of typos.
208
    assessedid  INT4 REFERENCES assessed (assessedid) NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
209
    componentid INT4,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
210
    marker      INT4 REFERENCES login (loginid) NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
211
    mark        INT,
212
    marked      TIMESTAMP,
213
    feedback    VARCHAR,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
214
    notes       VARCHAR
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
215
);
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
216
935 by wagrant
userdb: Large changes:
217
-- Worksheets
218
-- ----------
1099.1.195 by William Grant
Rename problem to exercise in the DB.
219
CREATE TABLE exercise (
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
220
    identifier  TEXT PRIMARY KEY CHECK (valid_url_name(identifier)),
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
221
    name        TEXT,
222
    description TEXT,
1720.1.4 by William Grant
Cache exercise and worksheet rST->XHTML conversions in the DB.
223
    description_xhtml_cache TEXT,
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
224
    partial     TEXT,
225
    solution    TEXT,
226
    include     TEXT,
227
    num_rows    INT4
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
228
);
229
725 by mattgiuca
The database now stores a cache of all the worksheets and what problems
230
CREATE TABLE worksheet (
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
231
    worksheetid SERIAL PRIMARY KEY,
232
    offeringid  INT4 REFERENCES offering (offeringid) NOT NULL,
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
233
    identifier  TEXT NOT NULL CHECK (valid_url_name(identifier)),
1099.4.1 by Nick Chadwick
Working on putting worksheets into the database.
234
    name        TEXT NOT NULL,
1099.4.3 by Nick Chadwick
Updated the tutorial service, to now allow users to edit worksheets
235
    data        TEXT NOT NULL,
1720.1.4 by William Grant
Cache exercise and worksheet rST->XHTML conversions in the DB.
236
    data_xhtml_cache TEXT,
1099.4.3 by Nick Chadwick
Updated the tutorial service, to now allow users to edit worksheets
237
    assessable  BOOLEAN NOT NULL,
1695.1.1 by William Grant
Add DB patch for mark showing, and worksheet cutoff and publishing.
238
    published   BOOLEAN NOT NULL DEFAULT true,
1099.1.184 by William Grant
Fix a column name mismatch between the migration and primary schema.
239
    seq_no      INT4 NOT NULL,
1099.4.3 by Nick Chadwick
Updated the tutorial service, to now allow users to edit worksheets
240
    format      TEXT NOT NUll,
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
241
    UNIQUE (offeringid, identifier)
725 by mattgiuca
The database now stores a cache of all the worksheets and what problems
242
);
243
1099.1.195 by William Grant
Rename problem to exercise in the DB.
244
CREATE TABLE worksheet_exercise (
245
    ws_ex_id        SERIAL PRIMARY KEY,
1099.4.3 by Nick Chadwick
Updated the tutorial service, to now allow users to edit worksheets
246
    worksheetid     INT4 REFERENCES worksheet (worksheetid) NOT NULL,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
247
    exerciseid      TEXT REFERENCES exercise (identifier) NOT NULL,
1099.1.185 by William Grant
A few almost-final worksheet/exercise schema changes. Mainly cosmetic.
248
    seq_no          INT4 NOT NULL,
249
    active          BOOLEAN NOT NULL DEFAULT true,
250
    optional        BOOLEAN NOT NULL,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
251
    UNIQUE (worksheetid, exerciseid)
725 by mattgiuca
The database now stores a cache of all the worksheets and what problems
252
);
253
1099.1.195 by William Grant
Rename problem to exercise in the DB.
254
CREATE TABLE exercise_attempt (
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
255
    loginid     INT4 REFERENCES login (loginid) NOT NULL,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
256
    ws_ex_id    INT4 REFERENCES worksheet_exercise (ws_ex_id) NOT NULL,
319 by drtomc
Partial correctness for the user database schema. A few bits and pieces to go.
257
    date        TIMESTAMP NOT NULL,
1099.1.185 by William Grant
A few almost-final worksheet/exercise schema changes. Mainly cosmetic.
258
    attempt     TEXT NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
259
    complete    BOOLEAN NOT NULL,
1021 by dcoles
Database: Adds active column to problem_attempt table.
260
    active      BOOLEAN NOT NULL DEFAULT true,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
261
    PRIMARY KEY (loginid, ws_ex_id, date)
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
262
);
263
1099.1.195 by William Grant
Rename problem to exercise in the DB.
264
CREATE TABLE exercise_save (
697 by mattgiuca
users.sql: Added database table problem_save, for storing exercises that are
265
    loginid     INT4 REFERENCES login (loginid) NOT NULL,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
266
    ws_ex_id    INT4 REFERENCES worksheet_exercise (ws_ex_id) NOT NULL,
697 by mattgiuca
users.sql: Added database table problem_save, for storing exercises that are
267
    date        TIMESTAMP NOT NULL,
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
268
    text        TEXT NOT NULL,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
269
    PRIMARY KEY (loginid, ws_ex_id)
697 by mattgiuca
users.sql: Added database table problem_save, for storing exercises that are
270
);
271
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
272
CREATE TABLE test_suite (
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
273
    suiteid     SERIAL PRIMARY KEY,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
274
    exerciseid  TEXT REFERENCES exercise (identifier) NOT NULL,
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
275
    description TEXT,
276
    seq_no      INT4,
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
277
    function    TEXT,
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
278
    stdin       TEXT
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
279
);
280
281
CREATE TABLE test_case (
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
282
    testid          SERIAL PRIMARY KEY,
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
283
    suiteid         INT4 REFERENCES test_suite (suiteid) NOT NULL,
284
    passmsg         TEXT,
285
    failmsg         TEXT,
286
    test_default    TEXT,
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
287
    seq_no          INT4
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
288
);
289
1099.1.195 by William Grant
Rename problem to exercise in the DB.
290
CREATE TABLE suite_variable (
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
291
    varid       SERIAL PRIMARY KEY,
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
292
    suiteid     INT4 REFERENCES test_suite (suiteid) NOT NULL,
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
293
    var_name    TEXT,
294
    var_value   TEXT,
295
    var_type    TEXT NOT NULL,
296
    arg_no      INT4
297
);
298
1099.1.195 by William Grant
Rename problem to exercise in the DB.
299
CREATE TABLE test_case_part (
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
300
    partid          SERIAL PRIMARY KEY,
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
301
    testid          INT4 REFERENCES test_case (testid) NOT NULL,
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
302
    part_type       TEXT NOT NULL,
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
303
    test_type       TEXT,
304
    data            TEXT,
305
    filename        TEXT
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
306
);
1099.1.142 by Nick Chadwick
Fixed a slight issue with the migration and the users.sql files not
307
COMMIT;