install.xml 43.2 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 11
                <FIELD NAME="field" TYPE="char" LENGTH="255" NOTNULL="true"/>
                <FIELD NAME="value" TYPE="text" LENGTH="small"/>
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
        <TABLE NAME="institution">
            <FIELDS>
39 40 41
                <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"/>
42
                <FIELD NAME="theme" TYPE="char" LENGTH="255" NOTNULL="false"/>
43
                <FIELD NAME="defaultmembershipperiod" TYPE="int" NOTNULL="false" />
44
                <FIELD NAME="maxuseraccounts" TYPE="int" NOTNULL="false" />
45 46 47
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
48 49
            </KEYS>
        </TABLE>
50 51 52 53 54 55 56
        <!-- 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" />
57 58
            </FIELDS>
            <KEYS>
59
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
60
            </KEYS>
61 62 63 64 65 66 67 68 69 70
        </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>
71
        </TABLE>
72
        <TABLE NAME="usr">
73
            <FIELDS>
74
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
75
                <FIELD NAME="username" TYPE="char" LENGTH="100" NOTNULL="true"/>
76 77 78
                <FIELD NAME="password" TYPE="char" LENGTH="40" NOTNULL="true"/>
                <FIELD NAME="salt" TYPE="char" LENGTH="8"/>
                <FIELD NAME="passwordchange" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
79
                <FIELD NAME="active" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1"/>
80 81
                <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
                <FIELD NAME="expiry" TYPE="datetime" NOTNULL="false"/>
82
                <FIELD NAME="expirymailsent" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
83
                <FIELD NAME="lastlogin" TYPE="datetime" NOTNULL="false"/>
84
                <FIELD NAME="lastlastlogin" TYPE="datetime" NOTNULL="false"/>
85
                <FIELD NAME="inactivemailsent" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
86 87 88 89 90 91
                <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"/>
92
                <FIELD NAME="email" TYPE="char" LENGTH="255" NOTNULL="false"/>
93 94 95 96
                <!-- 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. -->
                <FIELD NAME="profileicon" TYPE="int" LENGTH="10" NOTNULL="false"/>
Nigel McNie's avatar
Nigel McNie committed
97 98 99
                <FIELD NAME="suspendedctime" TYPE="datetime" NOTNULL="false"/>
                <FIELD NAME="suspendedreason" TYPE="text" NOTNULL="false"/>
                <FIELD NAME="suspendedcusr" TYPE="int" LENGTH="10" NOTNULL="false"/>
100 101
                <FIELD NAME="quota" TYPE="int" LENGTH="10" NOTNULL="false"/>
                <FIELD NAME="quotaused" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
102 103
                <FIELD NAME="authinstance" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" />
                <FIELD NAME="sessionid" TYPE="char" LENGTH="32" NOTNULL="false" DEFAULT="" />
104
                <FIELD NAME="lastauthinstance" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="NULL" />
105 106
            </FIELDS>
            <KEYS>
107
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
108
                <KEY NAME="lastauthinstancefk" TYPE="foreign" FIELDS="lastauthinstance" REFTABLE="auth_instance" REFFIELDS="id" />
109
                <KEY NAME="authinstancefk" TYPE="foreign" FIELDS="authinstance" REFTABLE="auth_instance" REFFIELDS="id" />
110 111
            </KEYS>
            <INDEXES>
112
                <INDEX NAME="usernameuk" UNIQUE="true" FIELDS="username"/>
113 114
            </INDEXES>
        </TABLE>
115 116 117 118 119 120
        <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"/>
121
                <FIELD NAME="expirymailsent" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
                <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>
147 148 149 150 151 152 153 154 155 156 157 158
        <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
159 160
        <TABLE NAME="sso_session">
            <FIELDS>
161 162
                <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
163 164 165 166 167 168 169 170
                <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>
171
                <KEY NAME="primary" TYPE="primary" FIELDS="userid,instanceid" />
Donal McMullan's avatar
Donal McMullan committed
172 173 174
                <!-- <KEY NAME="userfk" TYPE="foreign" FIELDS="userid,username" REFTABLE="usr" REFFIELDS="userid,username" /> -->
            </KEYS>
        </TABLE>
175 176
        <TABLE NAME="host">
            <FIELDS>
177 178 179 180 181 182 183 184
                <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"/>
                <FIELD NAME="portno" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="80"/>
                <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
185
                <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
186
                <FIELD NAME="lastconnecttime" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0"/>
187 188 189
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="wwwroot" />
190 191
                <KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name"/>
                <KEY NAME="appnamefk" TYPE="foreign" FIELDS="appname" REFTABLE="application" REFFIELDS="name"/>
192 193
            </KEYS>
        </TABLE>
194 195 196 197 198 199 200 201 202 203 204 205
        <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>
206 207
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="callfunctionuk" TYPE="unique" FIELDS="callfunction" />
208 209
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
210 211
        <TABLE NAME="activity_type">
            <FIELDS>
212
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
Penny Leach's avatar
Penny Leach committed
213
                <FIELD NAME="name" TYPE="char" LENGTH="50" NOTNULL="true" />
214
                <FIELD NAME="admin" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
215
                <FIELD NAME="delay" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
216 217
                <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
218 219
            </FIELDS>
            <KEYS>
220 221
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="namepluginuk" TYPE="unique" FIELDS="name, plugintype, pluginname" />
Penny Leach's avatar
Penny Leach committed
222 223 224 225 226
            </KEYS>
        </TABLE>
        <TABLE NAME="activity_queue">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
227
                <FIELD NAME="type" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
228 229 230 231 232
                <FIELD NAME="data" TYPE="text" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
233
                <KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="activity_type" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
234 235
            </KEYS>
        </TABLE>
236
        <TABLE NAME="grouptype">
Penny Leach's avatar
Penny Leach committed
237
            <FIELDS>
238
                <FIELD NAME="name" TYPE="char" LENGTH="20" NOTNULL="true" />
Richard Mansfield's avatar
Richard Mansfield committed
239 240
                <FIELD NAME="submittableto" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
                <FIELD NAME="defaultrole" TYPE="char" LENGTH="255" NOTNULL="true" />
241 242
            </FIELDS>
            <KEYS>
243
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
244 245
            </KEYS>
        </TABLE>
246
        <TABLE NAME="grouptype_roles">
247
            <FIELDS>
248
                <FIELD NAME="grouptype" TYPE="char" LENGTH="20" NOTNULL="true" />
Richard Mansfield's avatar
Richard Mansfield committed
249
                <FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="true" />
250
                <FIELD NAME="edit_views" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
251
                <FIELD NAME="see_submitted_views" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
252 253
            </FIELDS>
            <KEYS>
254 255
                <KEY NAME="primary" TYPE="primary" FIELDS="grouptype,role" />
                <KEY NAME="grouptypefk" TYPE="foreign" FIELDS="grouptype" REFTABLE="grouptype" REFFIELDS="name" />
256 257
            </KEYS>
        </TABLE>
258
        <TABLE NAME="group">
Penny Leach's avatar
Penny Leach committed
259 260
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
261
                <FIELD NAME="name" TYPE="char" LENGTH="128" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
262
                <FIELD NAME="description" TYPE="text" NOTNULL="false" />
263
                <FIELD NAME="grouptype" TYPE="char" LENGTH="20" NOTNULL="true"/>
Penny Leach's avatar
Penny Leach committed
264
                <FIELD NAME="jointype" TYPE="char" LENGTH="20" NOTNULL="true" ENUM="true" ENUMVALUES="'controlled', 'invite', 'request', 'open'"  DEFAULT="open" />
Penny Leach's avatar
Penny Leach committed
265 266
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
267
                <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
Penny Leach's avatar
Penny Leach committed
268 269 270 271
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="nameuk" TYPE="unique" FIELDS="name" />
272
                <KEY NAME="grouptypefk" TYPE="foreign" FIELDS="grouptype" REFTABLE="grouptype" REFFIELDS="name" />
Penny Leach's avatar
Penny Leach committed
273 274
            </KEYS>
        </TABLE>
275
        <TABLE NAME="group_member">
Penny Leach's avatar
Penny Leach committed
276
            <FIELDS>
277
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
278
                <FIELD NAME="member" TYPE="int" LENGTH="10" NOTNULL="true" />
Richard Mansfield's avatar
Richard Mansfield committed
279
                <FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
280 281 282
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
283 284
                <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
285 286 287
                <KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
288
        <TABLE NAME="group_member_request">
Penny Leach's avatar
Penny Leach committed
289
            <FIELDS>
290
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
291 292 293 294 295
                <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>
296 297
                <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
298 299 300
                <KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
301
        <TABLE NAME="group_member_invite">
Penny Leach's avatar
Penny Leach committed
302
            <FIELDS>
303
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
304 305 306
                <FIELD NAME="member" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="reason" TYPE="text" NOTNULL="false" />
307
                <FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
308 309
            </FIELDS>
            <KEYS>
310 311
                <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
312 313 314
                <KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
        <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" />
            </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" />
            </KEYS>
        </TABLE>
        <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
377
                <FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="true" />
378 379 380 381 382 383 384 385 386 387
                <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
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
        <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>
407 408 409 410 411 412 413 414
        <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
415 416
                <FIELD NAME="creator" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="deleted" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
417 418 419 420 421
            </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
422
                <KEY NAME="creatorfk" TYPE="foreign" FIELDS="creator" REFTABLE="usr" REFFIELDS="id" />
423 424
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
425 426 427
        <!-- user related tables -->
        <TABLE NAME="usr_account_preference">
            <FIELDS>
Penny Leach's avatar
Penny Leach committed
428
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
429 430 431 432
                <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
433
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,field" />
434
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
435 436 437 438
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_activity_preference">
            <FIELDS>
Penny Leach's avatar
Penny Leach committed
439
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
440
                <FIELD NAME="activity" TYPE="int" LENGTH="10" NOTNULL="true" />
441
                <FIELD NAME="method" TYPE="char" LENGTH="255" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
442 443
            </FIELDS>
            <KEYS>
Penny Leach's avatar
Penny Leach committed
444
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,activity" />
445
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
446
                <KEY NAME="activityfk" TYPE="foreign" FIELDS="activity" REFTABLE="activity_type" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
447 448 449 450 451
                <KEY NAME="methodfk" TYPE="foreign" FIELDS="method" REFTABLE="notification_installed" REFFIELDS="name" />
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_friend">
            <FIELDS>
452 453
                <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
454 455 456
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
457 458 459
               <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
460 461 462 463 464 465 466
            </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" />
467
                <FIELD NAME="message" TYPE="text" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
468 469 470 471 472 473 474 475 476 477
            </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" />
478 479 480 481 482 483 484
                <FIELD NAME="username" TYPE="char" LENGTH="30" NOTNULL="true"/>
                <FIELD NAME="password" TYPE="char" LENGTH="40" NOTNULL="true"/>
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="true"/>
                <FIELD NAME="salt" TYPE="char" LENGTH="8" NOTNULL="true"/>
                <FIELD NAME="firstname" TYPE="text" NOTNULL="true"/>
                <FIELD NAME="lastname" TYPE="text" NOTNULL="true"/>
                <FIELD NAME="email" TYPE="text" NOTNULL="true"/>
485
                <FIELD NAME="lang" TYPE="text" NOTNULL="false"/>
486 487
                <FIELD NAME="key" TYPE="char" LENGTH="16" NOTNULL="true"/>
                <FIELD NAME="expiry" TYPE="datetime" NOTNULL="true"/>
Penny Leach's avatar
Penny Leach committed
488 489 490
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
491
                <KEY NAME="institution" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name"/>
Penny Leach's avatar
Penny Leach committed
492
            </KEYS>
Richard Mansfield's avatar
Richard Mansfield committed
493 494 495 496 497 498 499 500 501 502 503
        </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
504 505 506
        </TABLE>
        <TABLE NAME="usr_password_request">
            <FIELDS>
Penny Leach's avatar
Penny Leach committed
507
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
508
                <FIELD NAME="expiry" TYPE="datetime" NOTNULL="true" />
509
                <FIELD NAME="key" TYPE="char" LENGTH="20" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
510 511
            </FIELDS>
            <KEYS>
Penny Leach's avatar
Penny Leach committed
512 513
                <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
514 515
            </KEYS>         
        </TABLE>
516 517 518 519 520 521 522 523 524 525 526
        <TABLE NAME="view_layout">
            <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>
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
        <TABLE NAME="view_type">
            <FIELDS>
                <FIELD NAME="type" TYPE="char" LENGTH="50" />
            </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>
542
                <KEY NAME="primary" TYPE="primary" FIELDS="blocktype,viewtype" />
543 544 545 546
                <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
547 548 549 550 551
        <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
552
                <FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="false" />
553
                <FIELD NAME="ownerformat" TYPE="text" NOTNULL="false" />
Richard Mansfield's avatar
Richard Mansfield committed
554
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="false" />
555
                <FIELD NAME="institution" TYPE="char" LENGTH="255" NOTNULL="false" />
556
                <FIELD NAME="startdate" TYPE="datetime" />
Martyn Smith's avatar
Martyn Smith committed
557
                <FIELD NAME="stopdate" TYPE="datetime" />
Penny Leach's avatar
Penny Leach committed
558 559
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
560
                <FIELD NAME="atime" TYPE="datetime" NOTNULL="true" />
561
                <FIELD NAME="submittedto" TYPE="int" LENGTH="10" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
562
                <FIELD NAME="numcolumns" TYPE="int" LENGTH="2" NOTNULL="true" />
563
                <FIELD NAME="layout" TYPE="int" LENGTH="10"/>
564
                <FIELD NAME="template" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
565
                <FIELD NAME="copynewuser" TYPE="int" LENGTH="1" DEFAULT="0" NOTNULL="true" />
566
                <FIELD NAME="type" TYPE="char" LENGTH="50" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
567 568 569 570
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
571
                <KEY NAME="submittedtofk" TYPE="foreign" FIELDS="submittedto" REFTABLE="group" REFFIELDS="id" />
572
                <KEY NAME="layoutfk" TYPE="foreign" FIELDS="layout" REFTABLE="view_layout" REFFIELDS="id"/>
Richard Mansfield's avatar
Richard Mansfield committed
573
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
574
                <KEY NAME="institutionfk" TYPE="foreign" FIELDS="institution" REFTABLE="institution" REFFIELDS="name" />
575
                <KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="view_type" REFFIELDS="type" />
Penny Leach's avatar
Penny Leach committed
576 577
            </KEYS>
        </TABLE>
578 579 580 581 582 583 584 585 586 587
        <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>
588 589 590 591 592 593 594 595 596 597 598
        <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
599
        <TABLE NAME="block_instance">
Penny Leach's avatar
Penny Leach committed
600 601
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
Penny Leach's avatar
Penny Leach committed
602 603 604
                <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
605
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
606 607
                <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
608 609 610
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
Penny Leach's avatar
Penny Leach committed
611
                <KEY NAME="blocktypefk" TYPE="foreign" FIELDS="blocktype" REFTABLE="blocktype_installed" REFFIELDS="name" />
Penny Leach's avatar
Penny Leach committed
612
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
613
                <KEY NAME="viewcolumnorderuk" TYPE="unique" FIELDS="view,column,order" />
614 615
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
616
        <TABLE NAME="view_artefact">
617 618 619
            <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
620
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
621 622 623 624 625
                <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
626
                <KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
627
                <KEY NAME="blockfk" TYPE="foreign" FIELDS="block" REFTABLE="block_instance" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
628 629
            </KEYS>
        </TABLE>
Richard Mansfield's avatar
Richard Mansfield committed
630 631
        <TABLE NAME="view_feedback">
            <FIELDS>
632
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
Richard Mansfield's avatar
Richard Mansfield committed
633 634
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="author" TYPE="int" LENGTH="10" NOTNULL="true" />
635
                <FIELD NAME="message" TYPE="text" NOTNULL="true" />
Richard Mansfield's avatar
Richard Mansfield committed
636 637 638 639 640 641 642 643 644 645 646
                <FIELD NAME="attachment" TYPE="int" LENGTH="10" NOTNULL="false" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="public" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
                <KEY NAME="authorfk" TYPE="foreign" FIELDS="author" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="attachmentfk" TYPE="foreign" FIELDS="attachment" REFTABLE="artefact" REFFIELDS="id" />
            </KEYS>
        </TABLE>
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663
        <TABLE NAME="artefact_feedback">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="author" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="message" TYPE="text" NOTNULL="false" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="public" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
                <KEY NAME="authorfk" TYPE="foreign" FIELDS="author" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
Martyn Smith's avatar
Martyn Smith committed
664 665 666
        <TABLE NAME="view_access">
            <FIELDS>
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
667
                <FIELD NAME="accesstype" TYPE="char" LENGTH="16" NOTNULL="true" ENUM="true" ENUMVALUES="'public', 'loggedin', 'friends'" DEFAULT="public" />
Martyn Smith's avatar
Martyn Smith committed
668 669 670 671 672 673 674
                <FIELD NAME="startdate" TYPE="datetime" NOTNULL="false" />
                <FIELD NAME="stopdate" TYPE="datetime" NOTNULL="false" />
            </FIELDS>
            <KEYS>
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
            </KEYS>
        </TABLE>
675
        <TABLE NAME="view_access_group">
Penny Leach's avatar
Penny Leach committed
676 677
            <FIELDS>
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
678
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="true" />
Richard Mansfield's avatar
Richard Mansfield committed
679
                <FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="false" />
Martyn Smith's avatar
Martyn Smith committed
680 681
                <FIELD NAME="startdate" TYPE="datetime" NOTNULL="false" />
                <FIELD NAME="stopdate" TYPE="datetime" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
682 683 684
            </FIELDS>
            <KEYS>
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
685
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
686 687
            </KEYS>
        </TABLE>
688
        <TABLE NAME="view_access_usr">
Penny Leach's avatar
Penny Leach committed
689 690
            <FIELDS>
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
691
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
Martyn Smith's avatar
Martyn Smith committed
692 693
                <FIELD NAME="startdate" TYPE="datetime" NOTNULL="false" />
                <FIELD NAME="stopdate" TYPE="datetime" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
694 695 696
            </FIELDS>
            <KEYS>
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
697
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
698 699 700 701 702 703 704 705 706 707 708 709 710 711
            </KEYS>
        </TABLE>
        <!-- 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" />
712
                <FIELD NAME="public" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
Penny Leach's avatar
Penny Leach committed
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728
                <!--- 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" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNOT="true" />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
729
                <FIELD NAME="mauthor" TYPE="int" LENGTH="10" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
730 731 732 733 734 735 736 737 738
            </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
739
                <FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
Penny Leach's avatar
Penny Leach committed
740 741 742 743
                <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
744
                <KEY NAME="primary" TYPE="primary" FIELDS="usr,view" />
745
                <KEY NAME="usrfk" TYPE="foreign" FIELDS="usr" REFTABLE="usr" REFFIELDS="id" />
Penny Leach's avatar
Penny Leach committed
746 747 748
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
            </KEYS>
        </TABLE>
749 750 751 752 753 754 755 756
        <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" />
                <FIELD NAME="queue" TYPE="int" LENGTH="1" NOTNULL="true" default="1" />
                <FIELD NAME="ready" TYPE="int" LENGTH="1" NOTNULL="true" default="0" />
                <FIELD NAME="expirytime" TYPE="datetime" NOTNULL="true" />
757 758 759
                <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"/>
760 761 762 763 764 765 766
            </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>
767
    </TABLES>
768
</XMLDB>