install.xml 68.8 KB
Newer Older
1
2
3
4
5
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20060926" COMMENT="XMLDB file for core Mahara tables"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
6
    <TABLES>
Penny Leach's avatar
Penny Leach committed
7
        <!-- core tables that plugins rely on -->
8
9
        <TABLE NAME="config">
            <FIELDS>
10
                <FIELD NAME="field" TYPE="char" LENGTH="255" NOTNULL="true"/>
11
                <FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="false"/>
12
13
            </FIELDS>
            <KEYS>
14
                <KEY NAME="primary" TYPE="primary" FIELDS="field" />
15
16
            </KEYS>
        </TABLE>
17
        <TABLE NAME="event_type">
18
            <FIELDS>
19
                <FIELD NAME="name" TYPE="char" LENGTH="50" NOTNULL="true" />
20
21
            </FIELDS>
            <KEYS>
Donal McMullan's avatar
Donal McMullan committed
22
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
23
24
            </KEYS>
        </TABLE>
25
26
27
28
29
30
31
32
33
34
35
36
        <TABLE NAME="event_subscription">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="event" TYPE="char" LENGTH="50" NOTNULL="true" />
                <FIELD NAME="callfunction" TYPE="char" LENGTH="255" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="eventfk" TYPE="foreign" FIELDS="event" REFTABLE="event_type" REFFIELDS="name" />
                <KEY NAME="subscruk" TYPE="unique" FIELDS="event,callfunction" />
            </KEYS>
        </TABLE>
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
        <TABLE NAME="style">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true"/>
                <FIELD NAME="css" TYPE="text" NOTNULL="false"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="style_property">
            <FIELDS>
                <FIELD NAME="style" TYPE="int" LENGTH="10" NOTNULL="true"/>
                <FIELD NAME="field" TYPE="char" LENGTH="100" NOTNULL="true"/>
                <FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="true"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="style,field" />
                <KEY NAME="stylefk" TYPE="foreign" FIELDS="style" REFTABLE="style" REFFIELDS="id"/>
            </KEYS>
        </TABLE>
58
59
        <TABLE NAME="institution">
            <FIELDS>
60
61
62
                <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true"/>
                <FIELD NAME="displayname" TYPE="char" LENGTH="255" NOTNULL="true"/>
                <FIELD NAME="registerallowed" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1"/>
63
                <FIELD NAME="theme" TYPE="char" LENGTH="255" NOTNULL="false"/>
64
                <FIELD NAME="defaultmembershipperiod" TYPE="int" NOTNULL="false" />
65
                <FIELD NAME="maxuseraccounts" TYPE="int" NOTNULL="false" />
66
67
68
                <FIELD NAME="expiry" TYPE="datetime" NOTNULL="false" />
                <FIELD NAME="expirymailsent" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
                <FIELD NAME="suspended" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
69
                <FIELD NAME="priority" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1"/>
70
                <FIELD NAME="defaultquota" TYPE="int" LENGTH="10" NOTNULL="false"/>
71
                <FIELD NAME="showonlineusers" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="2"/>
72
                <FIELD NAME="allowinstitutionpublicviews" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
73
                <FIELD NAME="registerconfirm" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1"/>
74
75
76
77
78
                <!-- This field should be foreign keyed to the artefact table, however the
                artefact table already has a key to this table, and XMLDB isn't smart enough
                to create the tables first, then the keys. The foreign key will be created
                during the postinst phase. -->
                <FIELD NAME="logo" TYPE="int" LENGTH="10" NOTNULL="false"/>
79
                <FIELD NAME="style" TYPE="int" LENGTH="10" NOTNULL="false"/>
80
81
                <FIELD NAME="licensemandatory" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
                <FIELD NAME="licensedefault" TYPE="char" LENGTH="255" NOTNULL="false"/>
82
                <FIELD NAME="dropdownmenu" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
83
                <FIELD NAME="skins" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1"/>
84
85
86
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
87
                <KEY NAME="stylefk" TYPE="foreign" FIELDS="style" REFTABLE="style" REFFIELDS="id"/>
88
89
            </KEYS>
        </TABLE>
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
        <TABLE NAME="institution_config">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="field" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="false" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
            </KEYS>
            <INDEXES>
                <INDEX NAME="instfielduk" UNIQUE="true" FIELDS="institution,field"/>
            </INDEXES>
        </TABLE>
105
106
107
108
109
110
111
        <!-- PLUGIN_TYPE_SUBSTITUTION -->
        <TABLE NAME="application">
            <FIELDS>
                <FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" />
                <FIELD NAME="displayname" TYPE="char" LENGTH="100" NOTNULL="true" />
                <FIELD NAME="xmlrpcserverurl" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="ssolandurl" TYPE="char" LENGTH="255" NOTNULL="true" />
112
113
            </FIELDS>
            <KEYS>
114
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
115
            </KEYS>
116
117
118
119
120
121
122
123
124
125
        </TABLE>
        <TABLE NAME="institution_locked_profile_field">
            <FIELDS>
                <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true"/>
                <FIELD NAME="profilefield" TYPE="char" LENGTH="255" NOTNULL="true"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="name, profilefield"/>
                <KEY NAME="name" TYPE="foreign" FIELDS="name" REFTABLE="institution" REFFIELDS="name"/>
            </KEYS>
126
        </TABLE>
127
        <TABLE NAME="usr">
128
            <FIELDS>
129
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
130
                <FIELD NAME="username" TYPE="char" LENGTH="255" NOTNULL="true"/>
131
                <FIELD NAME="password" TYPE="char" LENGTH="255" NOTNULL="true"/>
132
                <FIELD NAME="salt" TYPE="char" LENGTH="8" NOTNULL="false"/>
133
                <FIELD NAME="passwordchange" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
134
                <FIELD NAME="active" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1"/>
135
136
                <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
                <FIELD NAME="expiry" TYPE="datetime" NOTNULL="false"/>
137
                <FIELD NAME="expirymailsent" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
138
                <FIELD NAME="lastlogin" TYPE="datetime" NOTNULL="false"/>
139
                <FIELD NAME="lastlastlogin" TYPE="datetime" NOTNULL="false"/>
140
                <FIELD NAME="lastaccess" TYPE="datetime" NOTNULL="false"/>
141
                <FIELD NAME="inactivemailsent" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
142
143
144
145
146
147
                <FIELD NAME="staff" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
                <FIELD NAME="admin" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
                <FIELD NAME="firstname" TYPE="text" NOTNULL="false"/>
                <FIELD NAME="lastname" TYPE="text" NOTNULL="false"/>
                <FIELD NAME="studentid" TYPE="text" NOTNULL="false"/>
                <FIELD NAME="preferredname" TYPE="text" NOTNULL="false"/>
148
                <FIELD NAME="email" TYPE="char" LENGTH="255" NOTNULL="false"/>
149
150
                <!-- This field should be foreign keyed to the artefact table, however the
                artefact table already has a key to this table, and XMLDB isn't smart enough
151
152
                to create the tables first, then the keys. The foreign key will be created
                during the postinst phase. -->
153
                <FIELD NAME="profileicon" TYPE="int" LENGTH="10" NOTNULL="false"/>
Nigel McNie's avatar
Nigel McNie committed
154
155
156
                <FIELD NAME="suspendedctime" TYPE="datetime" NOTNULL="false"/>
                <FIELD NAME="suspendedreason" TYPE="text" NOTNULL="false"/>
                <FIELD NAME="suspendedcusr" TYPE="int" LENGTH="10" NOTNULL="false"/>
157
158
                <FIELD NAME="quota" TYPE="int" LENGTH="10" NOTNULL="false"/>
                <FIELD NAME="quotaused" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
159
                <FIELD NAME="authinstance" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" />
Richard Mansfield's avatar
Richard Mansfield committed
160
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="false" />
161
                <FIELD NAME="showhomeinfo" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
162
                <FIELD NAME="logintries" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
163
                <FIELD NAME="unread" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
164
                <FIELD NAME="urlid" TYPE="char" LENGTH="30" NOTNULL="false" />
165
166
167
                <!-- If adding a datetime column, you should also update the relevant
                functions in htdocs/auth/user.php and htdocs/lib/user.php to convert the
                value to a timestamp when a record is retrieved -->
168
169
            </FIELDS>
            <KEYS>
170
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
171
                <KEY NAME="authinstancefk" TYPE="foreign" FIELDS="authinstance" REFTABLE="auth_instance" REFFIELDS="id" />
172
173
            </KEYS>
            <INDEXES>
174
                <INDEX NAME="usernameuk" UNIQUE="true" FIELDS="username"/>
175
                <INDEX NAME="urliduk" UNIQUE="true" FIELDS="urlid" />
176
177
            </INDEXES>
        </TABLE>
178
179
180
181
182
183
        <TABLE NAME="usr_institution">
            <FIELDS>
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true"/>
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="false"/>
                <FIELD NAME="expiry" TYPE="datetime" NOTNULL="false"/>
184
                <FIELD NAME="expirymailsent" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
                <FIELD NAME="studentid" TYPE="text" NOTNULL="false"/>
                <FIELD NAME="staff" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
                <FIELD NAME="admin" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,institution" />
                <KEY NAME="usr" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id"/>
                <KEY NAME="institution" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name"/>
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_institution_request">
            <FIELDS>
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true"/>
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="confirmedusr" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
                <FIELD NAME="confirmedinstitution" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="false"/>
                <FIELD NAME="studentid" TYPE="text" NOTNULL="false"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,institution" />
                <KEY NAME="usr" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id"/>
                <KEY NAME="institution" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name"/>
            </KEYS>
        </TABLE>
210
211
212
213
214
215
216
217
218
219
220
221
222
        <TABLE NAME="usr_session">
            <FIELDS>
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="session" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="session" />
            </KEYS>
            <INDEXES>
                <INDEX NAME="usrix" UNIQUE="false" FIELDS="usr"/>
            </INDEXES>
        </TABLE>
Hugh Davenport's avatar
Hugh Davenport committed
223
224
225
226
227
228
229
230
231
232
        <TABLE NAME="usr_tag">
            <FIELDS>
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true"/>
                <FIELD NAME="tag" TYPE="char" LENGTH="128" NOTNULL="true"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,tag"/>
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id"/>
            </KEYS>
        </TABLE>
233
234
235
236
237
238
239
240
241
242
243
244
        <TABLE NAME="auth_remote_user">
            <FIELDS>
                <FIELD NAME="authinstance" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="remoteusername" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="localusr" TYPE="int" LENGTH="10" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="authinstance,remoteusername" />
                <KEY NAME="authinstancefk" TYPE="foreign" FIELDS="authinstance" REFTABLE="auth_instance" REFFIELDS="id" />
                <KEY NAME="localusrfk" TYPE="foreign" FIELDS="localusr" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
Donal McMullan's avatar
Donal McMullan committed
245
246
        <TABLE NAME="sso_session">
            <FIELDS>
247
248
                <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" />
                <FIELD NAME="instanceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" />
Donal McMullan's avatar
Donal McMullan committed
249
250
251
252
253
254
255
256
                <FIELD NAME="username" TYPE="char" LENGTH="30" NOTNULL="true"/>
                <FIELD NAME="useragent" TYPE="char" LENGTH="40" NOTNULL="true"/>
                <FIELD NAME="token" TYPE="char" LENGTH="40" NOTNULL="true"/>
                <FIELD NAME="confirmtimeout" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" />
                <FIELD NAME="expires" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" />
                <FIELD NAME="sessionid" TYPE="char" LENGTH="40" NOTNULL="true"/>
            </FIELDS>
            <KEYS>
257
                <KEY NAME="primary" TYPE="primary" FIELDS="userid,instanceid" />
Donal McMullan's avatar
Donal McMullan committed
258
259
260
                <!-- <KEY NAME="userfk" TYPE="foreign" FIELDS="userid,username" REFTABLE="usr" REFFIELDS="userid,username" /> -->
            </KEYS>
        </TABLE>
261
262
        <TABLE NAME="host">
            <FIELDS>
263
264
265
266
                <FIELD NAME="wwwroot" TYPE="char" LENGTH="255" NOTNULL="true"/>
                <FIELD NAME="name" TYPE="char" LENGTH="80" NOTNULL="true"/>
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true"/>
                <FIELD NAME="ipaddress" TYPE="char" LENGTH="39" NOTNULL="true"/>
267
                <FIELD NAME="portno" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="80"/>
268
269
270
                <FIELD NAME="appname" TYPE="char" LENGTH="20" NOTNULL="true"/>
                <FIELD NAME="publickey" TYPE="text" NOTNULL="true" DEFAULT=""/>
                <FIELD NAME="publickeyexpires" TYPE="int" LENGTH="10" NOTNULL="true"/>
Donal McMullan's avatar
Donal McMullan committed
271
                <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
272
                <FIELD NAME="lastconnecttime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0"/>
273
274
275
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="wwwroot" />
276
277
                <KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name"/>
                <KEY NAME="appnamefk" TYPE="foreign" FIELDS="appname" REFTABLE="application" REFFIELDS="name"/>
278
279
            </KEYS>
        </TABLE>
280
281
282
283
284
285
286
287
288
289
290
291
        <TABLE NAME="cron">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="callfunction" TYPE="char" LENGTH="255" NOTNULL="true"  />
                <FIELD NAME="nextrun" TYPE="datetime" NOTNULL="false"  />
                <FIELD NAME="minute" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*"  />
                <FIELD NAME="hour" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*"  />
                <FIELD NAME="day" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*"  />
                <FIELD NAME="month" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*"  />
                <FIELD NAME="dayofweek" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
            </FIELDS>
            <KEYS>
292
293
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="callfunctionuk" TYPE="unique" FIELDS="callfunction" />
294
295
            </KEYS>
        </TABLE>
296
297
298
299
300
301
302
303
304
305
306
307
308
        <TABLE NAME="event_log">
            <FIELDS>
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="realusr" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="time" TYPE="datetime" NOTNULL="true"  />
                <FIELD NAME="event" TYPE="char" LENGTH="255" NOTNULL="false"  />
                <FIELD NAME="data" TYPE="text" NOTNULL="false"  />
            </FIELDS>
            <KEYS>
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="realusrfk" TYPE="foreign" FIELDS="realusr" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
309
310
        <TABLE NAME="activity_type">
            <FIELDS>
311
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
Penny Leach's avatar
Penny Leach committed
312
                <FIELD NAME="name" TYPE="char" LENGTH="50" NOTNULL="true" />
313
                <FIELD NAME="admin" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
314
                <FIELD NAME="delay" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
315
316
                <FIELD NAME="plugintype" TYPE="char" LENGTH="25" NOTNULL="false" />
                <FIELD NAME="pluginname" TYPE="char" LENGTH="255" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
317
318
            </FIELDS>
            <KEYS>
319
320
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="namepluginuk" TYPE="unique" FIELDS="name, plugintype, pluginname" />
Penny Leach's avatar
Penny Leach committed
321
322
323
324
325
            </KEYS>
        </TABLE>
        <TABLE NAME="activity_queue">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
326
                <FIELD NAME="type" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
327
                <FIELD NAME="data" TYPE="text" NOTNULL="true" />
328
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="false" />
329
                <FIELD NAME="last_processed_userid" TYPE="int" LENGTH="10" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
330
331
332
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
333
                <KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="activity_type" REFFIELDS="id" />
334
                <KEY NAME="last_processed_useridfk" TYPE="foreign" FIELDS="last_processed_userid" REFTABLE="usr" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
335
336
            </KEYS>
        </TABLE>
337
        <TABLE NAME="grouptype">
Penny Leach's avatar
Penny Leach committed
338
            <FIELDS>
339
                <FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" />
Richard Mansfield's avatar
Richard Mansfield committed
340
                <FIELD NAME="defaultrole" TYPE="char" LENGTH="255" NOTNULL="true" />
341
342
            </FIELDS>
            <KEYS>
343
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
344
345
            </KEYS>
        </TABLE>
346
        <TABLE NAME="grouptype_roles">
347
            <FIELDS>
348
                <FIELD NAME="grouptype" TYPE="char" LENGTH="20" NOTNULL="true" />
Richard Mansfield's avatar
Richard Mansfield committed
349
                <FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="true" />
350
                <FIELD NAME="see_submitted_views" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
351
352
            </FIELDS>
            <KEYS>
353
354
                <KEY NAME="primary" TYPE="primary" FIELDS="grouptype,role" />
                <KEY NAME="grouptypefk" TYPE="foreign" FIELDS="grouptype" REFTABLE="grouptype" REFFIELDS="name" />
355
356
            </KEYS>
        </TABLE>
Richard Mansfield's avatar
Richard Mansfield committed
357
358
359
360
361
362
363
364
365
366
        <TABLE NAME="group_category">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="displayorder" TYPE="int" LENGTH="10" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
            </KEYS>
        </TABLE>
367
        <TABLE NAME="group">
Penny Leach's avatar
Penny Leach committed
368
369
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
370
                <FIELD NAME="name" TYPE="char" LENGTH="128" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
371
                <FIELD NAME="description" TYPE="text" NOTNULL="false" />
372
                <FIELD NAME="grouptype" TYPE="char" LENGTH="20" NOTNULL="true"/>
373
                <FIELD NAME="jointype" TYPE="char" LENGTH="20" NOTNULL="true" ENUM="true" ENUMVALUES="'open', 'controlled', 'approve'"  DEFAULT="open" />
Penny Leach's avatar
Penny Leach committed
374
375
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
376
                <FIELD NAME="public" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
377
                <FIELD NAME="usersautoadded" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
378
                <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
Richard Mansfield's avatar
Richard Mansfield committed
379
                <FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="false" />
380
                <FIELD NAME="viewnotify" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
Hugh Davenport's avatar
Hugh Davenport committed
381
382
                <FIELD NAME="quota" TYPE="int" LENGTH="10" NOTNULL="false"/>
                <FIELD NAME="quotaused" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
383
384
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
                <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="false" />
385
                <FIELD NAME="request" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
386
                <FIELD NAME="submittableto" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
387
                <FIELD NAME="editroles" TYPE="char" LENGTH="20" NOTNULL="true" ENUM="true" ENUMVALUES="'all', 'notmember', 'admin'" DEFAULT="all" />
388
                <FIELD NAME="hidden" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
389
                <FIELD NAME="hidemembers" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
390
                <FIELD NAME="hidemembersfrommembers" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
391
                <FIELD NAME="groupparticipationreports" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
392
393
                <FIELD NAME="invitefriends" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
                <FIELD NAME="suggestfriends" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
394
                <FIELD NAME="urlid" TYPE="char" LENGTH="30" NOTNULL="false" />
395
396
                <FIELD NAME="editwindowstart" TYPE="datetime" NOTNULL="false" />
                <FIELD NAME="editwindowend" TYPE="datetime" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
397
398
399
400
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="nameuk" TYPE="unique" FIELDS="name" />
401
                <KEY NAME="grouptypefk" TYPE="foreign" FIELDS="grouptype" REFTABLE="grouptype" REFFIELDS="name" />
Richard Mansfield's avatar
Richard Mansfield committed
402
                <KEY NAME="categoryfk" TYPE="foreign" FIELDS="category" REFTABLE="group_category" REFFIELDS="id" />
403
                <KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
Penny Leach's avatar
Penny Leach committed
404
            </KEYS>
405
406
            <INDEXES>
                <INDEX NAME="instshortuk" UNIQUE="true" FIELDS="institution, shortname"/>
407
                <INDEX NAME="urliduk" UNIQUE="true" FIELDS="urlid" />
408
            </INDEXES>
Penny Leach's avatar
Penny Leach committed
409
        </TABLE>
410
        <TABLE NAME="group_member">
Penny Leach's avatar
Penny Leach committed
411
            <FIELDS>
412
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
413
                <FIELD NAME="member" TYPE="int" LENGTH="10" NOTNULL="true" />
Richard Mansfield's avatar
Richard Mansfield committed
414
                <FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
415
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
416
                <FIELD NAME="method" TYPE="char" LENGTH="100" NOTNULL="true" DEFAULT="internal" />
Penny Leach's avatar
Penny Leach committed
417
418
            </FIELDS>
            <KEYS>
419
420
                <KEY NAME="primary" TYPE="primary" FIELDS="group,member" />
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
421
422
423
                <KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
424
        <TABLE NAME="group_member_request">
Penny Leach's avatar
Penny Leach committed
425
            <FIELDS>
426
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
427
428
429
430
431
                <FIELD NAME="member" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="reason" TYPE="text" NOTNULL="false" />
            </FIELDS>
            <KEYS>
432
433
                <KEY NAME="primary" TYPE="primary" FIELDS="group,member" />
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
434
435
436
                <KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
437
        <TABLE NAME="group_member_invite">
Penny Leach's avatar
Penny Leach committed
438
            <FIELDS>
439
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
440
441
442
                <FIELD NAME="member" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="reason" TYPE="text" NOTNULL="false" />
443
                <FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
444
445
            </FIELDS>
            <KEYS>
446
447
                <KEY NAME="primary" TYPE="primary" FIELDS="group,member" />
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
448
449
450
                <KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
        <TABLE NAME="artefact">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="artefacttype" TYPE="char" LENGTH="255" NOTNULL="true"  />
                <FIELD NAME="container" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"  />
                <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="false"  />
                <FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="false" />
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="false" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true"  />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true"  />
                <FIELD NAME="atime" TYPE="datetime" NOTNULL="true"  />
                <FIELD NAME="locked" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"  />
                <FIELD NAME="title" TYPE="text" NOTNULL="true"  />
                <FIELD NAME="description" TYPE="text" NOTNULL="false"  />
                <FIELD NAME="note" TYPE="text" NOTNULL="false" />
467
468
                <FIELD NAME="author" TYPE="int" LENGTH="10" NOTNULL="false" />
                <FIELD NAME="authorname" TYPE="text" NOTNULL="false" />
469
                <FIELD NAME="allowcomments" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"  />
470
                <FIELD NAME="approvecomments" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"  />
471
472
473
                <FIELD NAME="license" TYPE="char" LENGTH="255" NOTNULL="false" />
                <FIELD NAME="licensor" TYPE="char" LENGTH="255" NOTNULL="false" />
                <FIELD NAME="licensorurl" TYPE="char" LENGTH="255" NOTNULL="false" />
474
475
476
477
478
479
480
481
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="typefk" TYPE="foreign" FIELDS="artefacttype" REFTABLE="artefact_installed_type" REFFIELDS="name"  />
                <KEY NAME="parentfk" TYPE="foreign" FIELDS="parent" REFTABLE="artefact" REFFIELDS="id" />
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
482
                <KEY NAME="authorfk" TYPE="foreign" FIELDS="author" REFTABLE="usr" REFFIELDS="id" />
483
484
            </KEYS>
        </TABLE>
485
486
487
488
        <TABLE NAME="artefact_attachment">
            <FIELDS>
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="attachment" TYPE="int" LENGTH="10" NOTNULL="true" />
489
                <FIELD NAME="item" TYPE="int" LENGTH="10" NOTNULL="false" />
490
491
492
493
494
495
496
            </FIELDS>
            <KEYS>
                <KEY NAME="artefact_attachmentpk" TYPE="primary" FIELDS="artefact,attachment" />
                <KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
                <KEY NAME="attachmentfk" TYPE="foreign" FIELDS="attachment" REFTABLE="artefact" REFFIELDS="id" />
            </KEYS>
        </TABLE>
497
498
499
500
501
502
503
504
505
506
507
        <TABLE NAME="artefact_license">
            <FIELDS>
                <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="displayname" TYPE="char" LENGTH="255" NOTNULL="false" />
                <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="false" />
                <FIELD NAME="icon" TYPE="char" LENGTH="255" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
            </KEYS>
        </TABLE>
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
        <TABLE NAME="artefact_tag">
            <FIELDS>
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="tag" TYPE="char" LENGTH="128" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="artefact,tag" />
                <KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="artefact_parent_cache">
            <FIELDS>
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="dirty" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="artefact,parent" />
                <KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
                <KEY NAME="parentfk" TYPE="foreign" FIELDS="parent" REFTABLE="artefact" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="artefact_access_usr">
            <FIELDS>
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="can_republish" TYPE="int" LENGTH="1" NOTNULL="false" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,artefact" />
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="artefact_access_role">
            <FIELDS>
Richard Mansfield's avatar
Richard Mansfield committed
544
                <FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="true" />
545
546
547
548
549
550
551
552
553
554
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="can_view" TYPE="int" LENGTH="1" NOTNULL="true" />
                <FIELD NAME="can_edit" TYPE="int" LENGTH="1" NOTNULL="true" />
                <FIELD NAME="can_republish" TYPE="int" LENGTH="1" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="role,artefact" />
                <KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
            </KEYS>
        </TABLE>
Richard Mansfield's avatar
Richard Mansfield committed
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
        <TABLE NAME="artefact_log">
            <FIELDS>
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="false" />
                <FIELD NAME="time" TYPE="datetime" NOTNULL="true"  />
                <FIELD NAME="title" TYPE="text" NOTNULL="false"  />
                <FIELD NAME="description" TYPE="text" NOTNULL="false"  />
                <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="false" />
                <FIELD NAME="created" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="false" />
                <FIELD NAME="deleted" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="false" />
                <FIELD NAME="edited" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="false" />
            </FIELDS>
            <KEYS>
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
            <INDEXES>
                <INDEX NAME="artefactix" UNIQUE="false" FIELDS="artefact"/>
            </INDEXES>
        </TABLE>
574
575
576
577
578
579
580
581
        <TABLE NAME="interaction_instance">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="title" TYPE="text" NOTNULL="true"  />
                <FIELD NAME="description" TYPE="text" NOTNULL="false"  />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true"  />
Penny Leach's avatar
Penny Leach committed
582
583
                <FIELD NAME="creator" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="deleted" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
584
585
586
587
588
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="interaction_installed" REFFIELDS="name" />
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
Clare Lenihan's avatar
Clare Lenihan committed
589
                <KEY NAME="creatorfk" TYPE="foreign" FIELDS="creator" REFTABLE="usr" REFFIELDS="id" />
590
591
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
592
593
594
        <!-- user related tables -->
        <TABLE NAME="usr_account_preference">
            <FIELDS>
Penny Leach's avatar
Penny Leach committed
595
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
596
597
598
599
                <FIELD NAME="field" TYPE="char" LENGTH="100" NOTNULL="true" />
                <FIELD NAME="value" TYPE="text" NOTNULL="true" />
            </FIELDS>
            <KEYS>
Penny Leach's avatar
Penny Leach committed
600
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,field" />
601
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
602
603
604
605
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_activity_preference">
            <FIELDS>
Penny Leach's avatar
Penny Leach committed
606
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
607
                <FIELD NAME="activity" TYPE="int" LENGTH="10" NOTNULL="true" />
608
                <FIELD NAME="method" TYPE="char" LENGTH="255" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
609
610
            </FIELDS>
            <KEYS>
Penny Leach's avatar
Penny Leach committed
611
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,activity" />
612
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
613
                <KEY NAME="activityfk" TYPE="foreign" FIELDS="activity" REFTABLE="activity_type" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
614
615
616
617
618
                <KEY NAME="methodfk" TYPE="foreign" FIELDS="method" REFTABLE="notification_installed" REFFIELDS="name" />
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_friend">
            <FIELDS>
619
620
                <FIELD NAME="usr1" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="usr2" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
621
622
623
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
624
625
626
               <KEY NAME="primary" TYPE="primary" FIELDS="usr1,usr2" />
               <KEY NAME="usr1fk" TYPE="foreign" FIELDS="usr1" REFTABLE="usr" REFFIELDS="id" />
               <KEY NAME="usr2fk" TYPE="foreign" FIELDS="usr2" REFTABLE="usr" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
627
628
629
630
631
632
633
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_friend_request">
            <FIELDS>
                <FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="requester" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
634
                <FIELD NAME="message" TYPE="text" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
635
636
637
638
639
640
641
642
643
644
            </FIELDS>
            <KEYS>
               <KEY NAME="primary" TYPE="primary" FIELDS="owner,requester" />
               <KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
               <KEY NAME="requesterfk" TYPE="foreign" FIELDS="requester" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_registration">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" SEQUENCE="true" NOTNULL="true" />
645
646
647
648
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true"/>
                <FIELD NAME="firstname" TYPE="text" NOTNULL="true"/>
                <FIELD NAME="lastname" TYPE="text" NOTNULL="true"/>
                <FIELD NAME="email" TYPE="text" NOTNULL="true"/>
649
                <FIELD NAME="lang" TYPE="text" NOTNULL="false"/>
650
651
                <FIELD NAME="key" TYPE="char" LENGTH="16" NOTNULL="true"/>
                <FIELD NAME="expiry" TYPE="datetime" NOTNULL="true"/>
652
653
                <FIELD NAME="pending" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true"/>
                <FIELD NAME="reason" TYPE="text" NOTNULL="false"/>
654
                <FIELD NAME="extra" TYPE="text" NOTNULL="false"/>
655
                <FIELD NAME="authtype" TYPE="char" LENGTH="255" DEFAULT="internal" NOTNULL="true"/>
Penny Leach's avatar
Penny Leach committed
656
657
658
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
659
                <KEY NAME="institution" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name"/>
660
                <KEY NAME="authtype" TYPE="foreign" FIELDS="authtype" REFTABLE="auth_installed" REFFIELDS="name"/>
Penny Leach's avatar
Penny Leach committed
661
            </KEYS>
Richard Mansfield's avatar
Richard Mansfield committed
662
663
664
665
666
667
668
669
670
671
672
        </TABLE>
        <TABLE NAME="usr_infectedupload">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="time" TYPE="datetime" NOTNULL="true"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
Penny Leach's avatar
Penny Leach committed
673
674
675
        </TABLE>
        <TABLE NAME="usr_password_request">
            <FIELDS>
Penny Leach's avatar
Penny Leach committed
676
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
677
                <FIELD NAME="expiry" TYPE="datetime" NOTNULL="true" />
678
                <FIELD NAME="key" TYPE="char" LENGTH="20" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
679
680
            </FIELDS>
            <KEYS>
Penny Leach's avatar
Penny Leach committed
681
682
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,expiry" />
                <KEY NAME="foreign" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
683
684
            </KEYS>         
        </TABLE>
685
        <TABLE NAME="view_layout_columns">
686
687
688
689
690
691
692
693
694
695
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
                <FIELD NAME="columns" TYPE="int" LENGTH="1" NOTNULL="true"/>
                <FIELD NAME="widths" TYPE="char" LENGTH="255" NOTNULL="true"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
                <KEY NAME="columnwidthuk" TYPE="unique" FIELDS="columns,widths"/>
            </KEYS>
        </TABLE>
696
697
698
        <TABLE NAME="view_layout">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
699
700
701
                <FIELD NAME="rows" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1"/>
                <FIELD NAME="iscustom" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
                <FIELD NAME="layoutmenuorder" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0"/>
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
            </KEYS>
        </TABLE>
        <TABLE NAME="view_layout_rows_columns">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="viewlayout" TYPE="int" LENGTH="10" NOTNULL="true"/>
                <FIELD NAME="row" TYPE="int" LENGTH="1" NOTNULL="true"/>
                <FIELD NAME="columns" TYPE="int" LENGTH="10" NOTNULL="true"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id"/>            
                <KEY NAME="rowfk" TYPE="foreign" FIELDS="viewlayout" REFTABLE="view_layout" REFFIELDS="id"/>
                <KEY NAME="columnsfk" TYPE="foreign" FIELDS="columns" REFTABLE="view_layout_columns" REFFIELDS="id"/>
            </KEYS>
        </TABLE>
720
721
        <TABLE NAME="view_type">
            <FIELDS>
722
                <FIELD NAME="type" TYPE="char" LENGTH="50" NOTNULL="true" />
723
724
725
726
727
728
729
730
731
732
733
734
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="type" />
            </KEYS>
        </TABLE>
        <!-- this should really be with the rest of the blocktype plugin subsystem but can't because of ordering -->
        <TABLE NAME="blocktype_installed_viewtype">
            <FIELDS>
                <FIELD NAME="blocktype" TYPE="char" LENGTH="50" NOTNULL="true" />
                <FIELD NAME="viewtype" TYPE="char" LENGTH="50" NOTNULL="true" />
            </FIELDS>
            <KEYS>
735
                <KEY NAME="primary" TYPE="primary" FIELDS="blocktype,viewtype" />
736
737
738
739
                <KEY NAME="blocktypefk" TYPE="foreign" FIELDS="blocktype" REFTABLE="blocktype_installed" REFFIELDS="name"  />
                <KEY NAME="viewtypefk" TYPE="foreign" FIELDS="viewtype" REFTABLE="view_type" REFFIELDS="type"  />
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
740
741
742
743
744
        <TABLE NAME="view">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="title" TYPE="text" NOTNULL="true" />
                <FIELD NAME="description" TYPE="text" NOTNULL="false" />
Richard Mansfield's avatar
Richard Mansfield committed
745
                <FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="false" />
746
                <FIELD NAME="ownerformat" TYPE="text" NOTNULL="false" />
Richard Mansfield's avatar
Richard Mansfield committed
747
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="false" />
748
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
749
750
                <FIELD NAME="startdate" TYPE="datetime" NOTNULL="false" />
                <FIELD NAME="stopdate" TYPE="datetime" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
751
752
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
753
                <FIELD NAME="atime" TYPE="datetime" NOTNULL="true" />
754
755
                <FIELD NAME="submittedgroup" TYPE="int" LENGTH="10" NOTNULL="false" />
                <FIELD NAME="submittedhost" TYPE="char" LENGTH="255" NOTNULL="false" />
756
                <FIELD NAME="submittedtime" TYPE="datetime" NOTNULL="false" />
757
                <FIELD NAME="numrows" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" />
Penny Leach's avatar
Penny Leach committed
758
                <FIELD NAME="numcolumns" TYPE="int" LENGTH="2" NOTNULL="true" />
759
                <FIELD NAME="layout" TYPE="int" LENGTH="10" NOTNULL="false"/>
760
                <FIELD NAME="skin" TYPE="int" LENGTH="10" NOTNULL="false"/>
761
                <FIELD NAME="theme" TYPE="char" LENGTH="255" NOTNULL="false"/>
762
                <FIELD NAME="template" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
763
                <FIELD NAME="retainview" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
764
                <FIELD NAME="copynewuser" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
765
                <FIELD NAME="type" TYPE="char" LENGTH="50" NOTNULL="true" />
766
                <FIELD NAME="visits" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
767
                <FIELD NAME="allowcomments" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1"  />
768
                <FIELD NAME="approvecomments" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"  />
769
                <FIELD NAME="accessconf" TYPE="char" LENGTH="40" NOTNULL="false"/>
770
                <FIELD NAME="locked" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
771
                <FIELD NAME="urlid" TYPE="char" LENGTH="100" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
772
773
774
775
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
776
777
                <KEY NAME="submittedgroupfk" TYPE="foreign" FIELDS="submittedgroup" REFTABLE="group" REFFIELDS="id" />
                <KEY NAME="submittedhostfk" TYPE="foreign" FIELDS="submittedhost" REFTABLE="host" REFFIELDS="wwwroot" />
778
                <KEY NAME="layoutfk" TYPE="foreign" FIELDS="layout" REFTABLE="view_layout" REFFIELDS="id"/>
Richard Mansfield's avatar
Richard Mansfield committed
779
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
780
                <KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
781
                <KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="view_type" REFFIELDS="type" />
Penny Leach's avatar
Penny Leach committed
782
            </KEYS>
783
784
785
            <INDEXES>
                <INDEX NAME="urliduk" UNIQUE="true" FIELDS="urlid,owner,group,institution" />
            </INDEXES>
Penny Leach's avatar
Penny Leach committed
786
        </TABLE>
787
788
789
        <TABLE NAME="usr_custom_layout">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
790
791
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="false"/>
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="false"/>
792
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
793
794
795
796
797
798
                <FIELD NAME="layout" TYPE="int" LENGTH="10" NOTNULL="true"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="layoutfk" TYPE="foreign" FIELDS="layout" REFTABLE="view_layout" REFFIELDS="id"/>
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id"/>
799
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
800
                <KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
801
802
803
804
805
806
807
808
809
810
811
812
813
814
            </KEYS>
        </TABLE>
        <TABLE NAME="view_rows_columns">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true"/>
                <FIELD NAME="row" TYPE="int" LENGTH="1" NOTNULL="true"/>
                <FIELD NAME="columns" TYPE="int" LENGTH="1" NOTNULL="true"/>
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id"/>
            </KEYS>
        </TABLE>
815
816
817
818
819
820
821
822
823
824
        <TABLE NAME="view_tag">
            <FIELDS>
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="tag" TYPE="char" LENGTH="128" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="view,tag" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
            </KEYS>
        </TABLE>
825
826
827
828
829
830
831
832
833
834
835
        <TABLE NAME="view_autocreate_grouptype">
            <FIELDS>
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="grouptype" TYPE="char" LENGTH="20" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="view,grouptype" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
                <KEY NAME="grouptypefk" TYPE="foreign" FIELDS="grouptype" REFTABLE="grouptype" REFFIELDS="name" />
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
836
        <TABLE NAME="block_instance">
Penny Leach's avatar
Penny Leach committed
837
838
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
Penny Leach's avatar
Penny Leach committed
839
840
841
                <FIELD NAME="blocktype" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="configdata" TYPE="text" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
842
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
843
                <FIELD NAME="row" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" />
Penny Leach's avatar
Penny Leach committed
844
845
                <FIELD NAME="column" TYPE="int" LENGTH="2" NOTNULL="true" />
                <FIELD NAME="order" TYPE="int" LENGTH="2" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
846
847
848
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
Penny Leach's avatar
Penny Leach committed
849
                <KEY NAME="blocktypefk" TYPE="foreign" FIELDS="blocktype" REFTABLE="blocktype_installed" REFFIELDS="name" />
Penny Leach's avatar
Penny Leach committed
850
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
851
                <KEY NAME="viewrowcolumnorderuk" TYPE="unique" FIELDS="view,row,column,order" />
852
853
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
854
        <TABLE NAME="view_artefact">
855
856
857
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
858
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
859
860
861
862
863
                <FIELD NAME="block" TYPE="int" LENGTH="10" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
864
                <KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
865
                <KEY NAME="blockfk" TYPE="foreign" FIELDS="block" REFTABLE="block_instance" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
866
867
            </KEYS>
        </TABLE>
Martyn Smith's avatar
Martyn Smith committed
868
869
870
        <TABLE NAME="view_access">
            <FIELDS>
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
871
                <FIELD NAME="accesstype" TYPE="char" LENGTH="16" NOTNULL="false" ENUM="true" ENUMVALUES="'public', 'loggedin', 'friends', 'objectionable'" />
872
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="false" />
Richard Mansfield's avatar
Richard Mansfield committed
873
                <FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="false" />
874
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="false" />
875
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
876
877
                <FIELD NAME="token" TYPE="char" LENGTH="100" NOTNULL="false" />
                <FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
Martyn Smith's avatar
Martyn Smith committed
878
879
                <FIELD NAME="startdate" TYPE="datetime" NOTNULL="false" />
                <FIELD NAME="stopdate" TYPE="datetime" NOTNULL="false" />
880
881
                <FIELD NAME="allowcomments" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
                <FIELD NAME="approvecomments" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
882
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
883
884
885
            </FIELDS>
            <KEYS>
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
886
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
887
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
888
                <KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
Penny Leach's avatar
Penny Leach committed
889
            </KEYS>
890
            <INDEXES>
891
                <INDEX NAME="tokenix" UNIQUE="false" FIELDS="token"/>
892
                <INDEX NAME="accesstypeix" UNIQUE="false" FIELDS="accesstype"/>
893
            </INDEXES>
Richard Mansfield's avatar
Richard Mansfield committed
894
        </TABLE>
895
896
897
898
899
900
901
902
903
904
905
906
        <TABLE NAME="view_visit">
            <FIELDS>
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
            </KEYS>
            <INDEXES>
                <INDEX NAME="ctimeix" UNIQUE="false" FIELDS="ctime"/>
            </INDEXES>
        </TABLE>
Richard Mansfield's avatar
Richard Mansfield committed
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
        <TABLE NAME="favorite">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
            </KEYS>
            <INDEXES>
                <INDEX NAME="ownershortuk" UNIQUE="true" FIELDS="owner,shortname"/>
            </INDEXES>
        </TABLE>
        <TABLE NAME="favorite_usr">
            <FIELDS>
                <FIELD NAME="favorite" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
            </FIELDS>
            <KEYS>
               <KEY NAME="primary" TYPE="primary" FIELDS="favorite,usr" />
               <KEY NAME="favoritefk" TYPE="foreign" FIELDS="favorite" REFTABLE="favorite" REFFIELDS="id" />
               <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
936
937
938
939
940
941
942
943
944
945
946
947
        <!-- site content stuff -->
        <!-- 
        <TABLE NAME="site_file">
        </TABLE>
        -->
        <TABLE NAME="site_menu">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="title" TYPE="text" NOTNULL="true" />
                <FIELD NAME="file" TYPE="int" LENGTH="10" NOTNULL="false" />
                <FIELD NAME="url" TYPE="text" NOTNULL="false" />
                <FIELD NAME="displayorder" TYPE="int" LENGTH="10" NOTNULL="true" />
948
                <FIELD NAME="public" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
Penny Leach's avatar
Penny Leach committed
949
950
951
952
953
954
955
956
957
958
959
960
961
962
                <!--- public? -->
                <!-- displayorder maybe should be the primary key -->
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
            <!--
                <KEY NAME="filefk" TYPE="foreign" FIELDS="file" REFTABLE="site_file" REFFIELDS="id" />
            -->
            </KEYS>
        </TABLE>
        <TABLE NAME="site_content"> 
            <FIELDS>
                <FIELD NAME="name" TYPE="char" LENGTH="50" NOTNULL="true" />
                <FIELD NAME="content" TYPE="text" NOTNULL="true" />
963
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
964
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
965
                <FIELD NAME="mauthor" TYPE="int" LENGTH="10" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
966
967
968
969
970
971
972
973
974
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
                <KEY NAME="mauthorfk" TYPE="foreign" FIELDS="mauthor" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <!-- watchlist stuff -->
        <TABLE NAME="usr_watchlist_view">
            <FIELDS>
Penny Leach's avatar
Penny Leach committed
975
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
976
977
978
979
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
Penny Leach's avatar
Penny Leach committed
980
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,view" />
981
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
982
983
984
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
            </KEYS>
        </TABLE>
985
986
987
988
989
        <TABLE NAME="import_queue">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="host" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
990
991
                <FIELD NAME="queue" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
                <FIELD NAME="ready" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
992
                <FIELD NAME="expirytime" TYPE="datetime" NOTNULL="true" />
993
994
995
                <FIELD NAME="format" TYPE="char" LENGTH="50" NOTNULL="false" />
                <FIELD NAME="data" TYPE="text" NOTNULL="false" />
                <FIELD NAME="token" TYPE="char" LENGTH="40" NOTNULL="true"/>
996
997
998
999
1000
1001
1002
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="hostfk" TYPE="foreign" FIELDS="host" REFTABLE="host" REFFIELDS="wwwroot" />
            </KEYS>
        </TABLE>
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
        <TABLE NAME="import_entry_requests">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="importid" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="entryid" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="entryparent" TYPE="char" LENGTH="255" NOTNULL="false" />