~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
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
186
CREATE TABLE project_extension (
1165.1.2 by William Grant
Add serial primary keys to project_{extension,submission}.
187
    extensionid SERIAL PRIMARY KEY,
391 by drtomc
Fix a couple of typos.
188
    assessedid  INT4 REFERENCES assessed (assessedid) NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
189
    deadline    TIMESTAMP NOT NULL,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
190
    approver    INT4 REFERENCES login (loginid) NOT NULL,
191
    notes       VARCHAR
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
192
);
193
665 by drtomc
userdb: Add a submission table, as per our discussions.
194
CREATE TABLE project_submission (
1165.1.2 by William Grant
Add serial primary keys to project_{extension,submission}.
195
    submissionid SERIAL PRIMARY KEY,
665 by drtomc
userdb: Add a submission table, as per our discussions.
196
    assessedid  INT4 REFERENCES assessed (assessedid) NOT NULL,
197
    path        VARCHAR NOT NULL,
1165.1.1 by Matt Giuca
users.sql: Added to project_submission: 'date_submitted'.
198
    revision    INT4 NOT NULL,
1165.1.42 by William Grant
Record who submitted each submission.
199
    date_submitted TIMESTAMP NOT NULL,
200
    submitter   INT4 REFERENCES login (loginid) NOT NULL
665 by drtomc
userdb: Add a submission table, as per our discussions.
201
);
202
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
203
CREATE TABLE project_mark (
391 by drtomc
Fix a couple of typos.
204
    assessedid  INT4 REFERENCES assessed (assessedid) NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
205
    componentid INT4,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
206
    marker      INT4 REFERENCES login (loginid) NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
207
    mark        INT,
208
    marked      TIMESTAMP,
209
    feedback    VARCHAR,
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
210
    notes       VARCHAR
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
211
);
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
212
935 by wagrant
userdb: Large changes:
213
-- Worksheets
214
-- ----------
1099.1.195 by William Grant
Rename problem to exercise in the DB.
215
CREATE TABLE exercise (
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
216
    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
217
    name        TEXT,
218
    description TEXT,
1720.1.4 by William Grant
Cache exercise and worksheet rST->XHTML conversions in the DB.
219
    description_xhtml_cache TEXT,
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
220
    partial     TEXT,
221
    solution    TEXT,
222
    include     TEXT,
223
    num_rows    INT4
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
224
);
225
725 by mattgiuca
The database now stores a cache of all the worksheets and what problems
226
CREATE TABLE worksheet (
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
227
    worksheetid SERIAL PRIMARY KEY,
228
    offeringid  INT4 REFERENCES offering (offeringid) NOT NULL,
1606.1.1 by William Grant
Add DB constraints for names used in URLs.
229
    identifier  TEXT NOT NULL CHECK (valid_url_name(identifier)),
1099.4.1 by Nick Chadwick
Working on putting worksheets into the database.
230
    name        TEXT NOT NULL,
1099.4.3 by Nick Chadwick
Updated the tutorial service, to now allow users to edit worksheets
231
    data        TEXT NOT NULL,
1720.1.4 by William Grant
Cache exercise and worksheet rST->XHTML conversions in the DB.
232
    data_xhtml_cache TEXT,
1099.4.3 by Nick Chadwick
Updated the tutorial service, to now allow users to edit worksheets
233
    assessable  BOOLEAN NOT NULL,
1695.1.1 by William Grant
Add DB patch for mark showing, and worksheet cutoff and publishing.
234
    published   BOOLEAN NOT NULL DEFAULT true,
1099.1.184 by William Grant
Fix a column name mismatch between the migration and primary schema.
235
    seq_no      INT4 NOT NULL,
1099.4.3 by Nick Chadwick
Updated the tutorial service, to now allow users to edit worksheets
236
    format      TEXT NOT NUll,
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
237
    UNIQUE (offeringid, identifier)
725 by mattgiuca
The database now stores a cache of all the worksheets and what problems
238
);
239
1099.1.195 by William Grant
Rename problem to exercise in the DB.
240
CREATE TABLE worksheet_exercise (
241
    ws_ex_id        SERIAL PRIMARY KEY,
1099.4.3 by Nick Chadwick
Updated the tutorial service, to now allow users to edit worksheets
242
    worksheetid     INT4 REFERENCES worksheet (worksheetid) NOT NULL,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
243
    exerciseid      TEXT REFERENCES exercise (identifier) NOT NULL,
1099.1.185 by William Grant
A few almost-final worksheet/exercise schema changes. Mainly cosmetic.
244
    seq_no          INT4 NOT NULL,
245
    active          BOOLEAN NOT NULL DEFAULT true,
246
    optional        BOOLEAN NOT NULL,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
247
    UNIQUE (worksheetid, exerciseid)
725 by mattgiuca
The database now stores a cache of all the worksheets and what problems
248
);
249
1099.1.195 by William Grant
Rename problem to exercise in the DB.
250
CREATE TABLE exercise_attempt (
354 by drtomc
Addressed the rest of sb's suggestions. No doubt this will lead to more suggestions. :-)
251
    loginid     INT4 REFERENCES login (loginid) NOT NULL,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
252
    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.
253
    date        TIMESTAMP NOT NULL,
1099.1.185 by William Grant
A few almost-final worksheet/exercise schema changes. Mainly cosmetic.
254
    attempt     TEXT NOT NULL,
296 by drtomc
Almost SQLized the database stuff from yesterday's discussion with sb.
255
    complete    BOOLEAN NOT NULL,
1021 by dcoles
Database: Adds active column to problem_attempt table.
256
    active      BOOLEAN NOT NULL DEFAULT true,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
257
    PRIMARY KEY (loginid, ws_ex_id, date)
281 by stevenbird
extensive updates based on data modelling discussion with Tom Conway
258
);
259
1099.1.195 by William Grant
Rename problem to exercise in the DB.
260
CREATE TABLE exercise_save (
697 by mattgiuca
users.sql: Added database table problem_save, for storing exercises that are
261
    loginid     INT4 REFERENCES login (loginid) NOT NULL,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
262
    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
263
    date        TIMESTAMP NOT NULL,
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
264
    text        TEXT NOT NULL,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
265
    PRIMARY KEY (loginid, ws_ex_id)
697 by mattgiuca
users.sql: Added database table problem_save, for storing exercises that are
266
);
267
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
268
CREATE TABLE test_suite (
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
269
    suiteid     SERIAL PRIMARY KEY,
1099.1.195 by William Grant
Rename problem to exercise in the DB.
270
    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
271
    description TEXT,
272
    seq_no      INT4,
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
273
    function    TEXT,
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
274
    stdin       TEXT
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
275
);
276
277
CREATE TABLE test_case (
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
278
    testid          SERIAL PRIMARY KEY,
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
279
    suiteid         INT4 REFERENCES test_suite (suiteid) NOT NULL,
280
    passmsg         TEXT,
281
    failmsg         TEXT,
282
    test_default    TEXT,
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
283
    seq_no          INT4
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
284
);
285
1099.1.195 by William Grant
Rename problem to exercise in the DB.
286
CREATE TABLE suite_variable (
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
287
    varid       SERIAL PRIMARY KEY,
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
288
    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.
289
    var_name    TEXT,
290
    var_value   TEXT,
291
    var_type    TEXT NOT NULL,
292
    arg_no      INT4
293
);
294
1099.1.195 by William Grant
Rename problem to exercise in the DB.
295
CREATE TABLE test_case_part (
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
296
    partid          SERIAL PRIMARY KEY,
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
297
    testid          INT4 REFERENCES test_case (testid) NOT NULL,
1099.1.145 by Nick Chadwick
Minor updates to the sql for the userdb
298
    part_type       TEXT NOT NULL,
1099.1.141 by Nick Chadwick
Updated the exercises to be loaded from the database, not a local file.
299
    test_type       TEXT,
300
    data            TEXT,
301
    filename        TEXT
1099.1.114 by Nick Chadwick
Modified the database so that exercises are now stored in the database, rather
302
);
1099.1.142 by Nick Chadwick
Fixed a slight issue with the migration and the users.sql files not
303
COMMIT;