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