install.xml 35.8 KB
Newer Older
1 2 3 4 5
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20060926" COMMENT="XMLDB file for core Mahara tables"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
6
    <TABLES>
Penny Leach's avatar
Penny Leach committed
7
        <!-- core tables that plugins rely on -->
8 9 10 11
        <TABLE NAME="config">
            <FIELDS>
                <FIELD NAME="field" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="true" />
12 13
            </FIELDS>
            <KEYS>
14
                <KEY NAME="primary" TYPE="primary" FIELDS="field" />
15 16
            </KEYS>
        </TABLE>
17
        <TABLE NAME="usr">
18
            <FIELDS>
19
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
20
                <FIELD NAME="username" TYPE="char" LENGTH="30" NOTNULL="true" />
21 22
                <FIELD NAME="password" TYPE="char" LENGTH="40" NOTNULL="true" />
                <FIELD NAME="salt" TYPE="char" LENGTH="8" />
Penny Leach's avatar
Penny Leach committed
23 24 25 26 27 28
                <FIELD NAME="passwordchange" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
                <FIELD NAME="deleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
                <FIELD NAME="expiry" TYPE="datetime" NOTNULL="false" />
                <FIELD NAME="lastlogin" TYPE="datetime" NOTNULL="false" />
                <FIELD NAME="staff" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
                <FIELD NAME="admin" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
29 30 31 32
                <FIELD NAME="firstname" TYPE="text" NOTNULL="true" />
                <FIELD NAME="lastname" TYPE="text" NOTNULL="true" />
                <FIELD NAME="prefname" TYPE="text" NOTNULL="false" />
                <FIELD NAME="email" TYPE="text" NOTNULL="true" />
33 34
            </FIELDS>
            <KEYS>
35
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
36 37 38 39 40
            </KEYS>
            <INDEXES>
                <INDEX NAME="usernameuk" UNIQUE="true" FIELDS="LOWER(username)"/>
            </INDEXES>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
41
        <TABLE NAME="event_type">
42 43 44 45 46
            <FIELDS>
                <FIELD NAME="name" TYPE="char" LENGTH="50" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
47 48
            </KEYS>
        </TABLE>
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
        <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>
                <KEY NAME="primary" TYPE="primary" FIELDS="callfunction" />
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
64 65 66
        <TABLE NAME="activity_type">
            <FIELDS>
                <FIELD NAME="name" TYPE="char" LENGTH="50" NOTNULL="true" />
67
                <FIELD NAME="admin" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
68
                <FIELD NAME="delay" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
Penny Leach's avatar
Penny Leach committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
            </KEYS>
        </TABLE>
        <TABLE NAME="activity_queue">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="type" TYPE="char" LENGTH="50" NOTNULL="true" />
                <FIELD NAME="data" TYPE="text" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="typefk" TYPE="foreign" FIELDS="type" REFTABLE="activity_type" REFFIELDS="name" />
            </KEYS>
        </TABLE>
86
        <!-- auth plugin tables -->
87
        <TABLE NAME="auth_installed">
88
            <FIELDS> 
89 90 91 92
                <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="release" TYPE="text" LENGTH="small" NOTNULL="true" />
                <FIELD NAME="active" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
93 94
            </FIELDS>
            <KEYS>
95
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
96 97
            </KEYS>
        </TABLE>
98
        <TABLE NAME="auth_config">
99
            <FIELDS>
100 101
                <FIELD NAME="plugin" TYPE="char" LENGTH="100" NOTNULL="true" />
                <FIELD NAME="field" TYPE="char" LENGTH="100" NOTNULL="true" />
102
                <FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="true" />
103 104
            </FIELDS>
            <KEYS>
105 106
                <KEY NAME="primary" TYPE="primary" FIELDS="plugin,field" />
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="auth_installed" REFFIELDS="name" />
107 108
            </KEYS>
        </TABLE>
109
        <TABLE NAME="auth_cron">
110
            <FIELDS>
111 112 113 114 115 116 117 118
                <FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="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="*" />
119 120
            </FIELDS>
            <KEYS>
121 122
                <KEY NAME="primary" TYPE="primary" FIELDS="plugin,callfunction" />
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="auth_installed" REFFIELDS="name" />
123 124
            </KEYS>
        </TABLE>
125
        <TABLE NAME="auth_event_subscription">
126
            <FIELDS>
127 128 129 130
                <FIELD NAME="id" TYPE="int" LENGTH="10" SEQUENCE="true"  NOTNULL="true" />
                <FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="event" TYPE="char" LENGTH="50" NOTNULL="true" />
                <FIELD NAME="callfunction" TYPE="char" LENGTH="255" NOTNULL="true" />
131 132
            </FIELDS>
            <KEYS>
133
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
134
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="auth_installed" REFFIELDS="name" />
Penny Leach's avatar
Penny Leach committed
135
                <KEY NAME="eventfk" TYPE="foreign" FIELDS="event" REFTABLE="event_type" REFFIELDS="name" />
136
                <KEY NAME="subscruk" TYPE="unique" FIELDS="plugin,event,callfunction" />
137 138
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
        <!-- notification plugin tables -->
        <TABLE NAME="notification_installed">
            <FIELDS> 
                <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="release" TYPE="text" LENGTH="small" NOTNULL="true" />
                <FIELD NAME="active" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
            </KEYS>
        </TABLE>
        <TABLE NAME="notification_config">
            <FIELDS>
                <FIELD NAME="plugin" TYPE="char" LENGTH="100" NOTNULL="true" />
                <FIELD NAME="field" TYPE="char" LENGTH="100" NOTNULL="true" />
                <FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="plugin,field" />
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="notification_installed" REFFIELDS="name" />
            </KEYS>
        </TABLE>
        <TABLE NAME="notification_cron">
            <FIELDS>
                <FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="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>
                <KEY NAME="primary" TYPE="primary" FIELDS="plugin,callfunction" />
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="notification_installed" REFFIELDS="name" />
            </KEYS>
        </TABLE>
        <TABLE NAME="notification_event_subscription">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" SEQUENCE="true"  NOTNULL="true" />
                <FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="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="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="notification_installed" REFFIELDS="name" />
                <KEY NAME="eventfk" TYPE="foreign" FIELDS="event" REFTABLE="event_type" REFFIELDS="name" />
                <KEY NAME="subscruk" TYPE="unique" FIELDS="plugin,event,callfunction" />
            </KEYS>
        </TABLE>
192 193 194 195 196 197 198 199 200 201 202 203 204
        <!-- artefact plugin tables -->
        <TABLE NAME="artefact_installed">
            <FIELDS> 
                <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="version" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="release" TYPE="text" LENGTH="small" NOTNULL="true" />
                <FIELD NAME="active" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
            </KEYS>
        </TABLE>
        <TABLE NAME="artefact_installed_type">
205
            <FIELDS>
206
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
207 208
                <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="true" />
209 210
            </FIELDS>
            <KEYS>
211
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
212 213 214 215 216 217 218 219 220 221 222 223 224
                <KEY NAME="nameuk" TYPE="unique" FIELDS="name,plugin"  />
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="artefact_installed" REFFIELDS="name" />
            </KEYS>
        </TABLE>
        <TABLE NAME="artefact_config">
            <FIELDS>
                <FIELD NAME="plugin" TYPE="char" LENGTH="100" NOTNULL="true" />
                <FIELD NAME="field" TYPE="char" LENGTH="100" NOTNULL="true" />
                <FIELD NAME="value" TYPE="text" LENGTH="small" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="plugin,field" />
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="artefact_installed" REFFIELDS="name" />
225 226
            </KEYS>
        </TABLE>
227
        <TABLE NAME="artefact_cron">
228
            <FIELDS>
229
                <FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="true" />
230
                <FIELD NAME="callfunction" TYPE="char" LENGTH="255" NOTNULL="true"  />
231 232 233 234 235 236
                <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="*" />
237 238
            </FIELDS>
            <KEYS>
239
                <KEY NAME="primary" TYPE="primary" FIELDS="plugin,callfunction" />
240
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="artefact_installed" REFFIELDS="name" />
241 242
            </KEYS>
        </TABLE>
243
        <TABLE NAME="artefact_event_subscription">
244 245 246 247 248 249 250 251
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" SEQUENCE="true"  NOTNULL="true" />
                <FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="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" />
252
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="artefact_installed" REFFIELDS="name" />
Penny Leach's avatar
Penny Leach committed
253
                <KEY NAME="eventfk" TYPE="foreign" FIELDS="event" REFTABLE="event_type" REFFIELDS="name" />
254 255 256
                <KEY NAME="subscruk" TYPE="unique" FIELDS="plugin,event,callfunction" />
            </KEYS>
        </TABLE>
Penny Leach's avatar
Penny Leach committed
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 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 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 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581
        <!-- end of artefact plugin tables, back to core tables -->
        <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="true" />
                <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="id"  />
                <KEY NAME="parentfk" TYPE="foreign" FIELDS="parent" REFTABLE="artefact" REFFIELDS="id" />
                <KEY NAME="userfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="community">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="name" TYPE="text" NOTNULL="true" />
                <FIELD NAME="description" TYPE="text" NOTNULL="false" />
                <FIELD NAME="jointype" TYPE="char" LENGTH="20" NOTNULL="true" DEFAULT="anyone" />
                <FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="nameuk" TYPE="unique" FIELDS="name" />
                <KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="community_member">
            <FIELDS>
                <FIELD NAME="community" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="member" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="tutor" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="community,member" />
                <KEY NAME="communityfk" TYPE="foreign" FIELDS="community" REFTABLE="community" REFFIELDS="id" />
                <KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="community_member_request">
            <FIELDS>
                <FIELD NAME="community" TYPE="int" LENGTH="10" NOTNULL="true" />
                <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>
                <KEY NAME="primary" TYPE="primary" FIELDS="community,member" />
                <KEY NAME="communityfk" TYPE="foreign" FIELDS="community" REFTABLE="community" REFFIELDS="id" />
                <KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="community_member_invite">
            <FIELDS>
                <FIELD NAME="community" TYPE="int" LENGTH="10" NOTNULL="true" />
                <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>
                <KEY NAME="primary" TYPE="primary" FIELDS="community,member" />
                <KEY NAME="communityfk" TYPE="foreign" FIELDS="community" REFTABLE="community" REFFIELDS="id" />
                <KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <!-- user related tables -->
        <TABLE NAME="usr_group"> 
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="name" TYPE="text" NOTNULL="true" />
                <FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="description" TYPE="text" NOTNULL="false" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_group_member">
            <FIELDS>
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="member" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="group,member" />
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="usr_group" REFFIELDS="id" />
                <KEY NAME="memberfk" TYPE="foreign" FIELDS="member" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_account_preference">
            <FIELDS>
                <FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="field" TYPE="char" LENGTH="100" NOTNULL="true" />
                <FIELD NAME="value" TYPE="text" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="user,field" />
                <KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_activity_preference">
            <FIELDS>
                <FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="activity" TYPE="char" LENGTH="100" NOTNULL="true" />
                <FIELD NAME="method" TYPE="text" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="user,activity" />
                <KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="activityfk" TYPE="foreign" FIELDS="activity" REFTABLE="activity_type" REFFIELDS="name" />
                <KEY NAME="methodfk" TYPE="foreign" FIELDS="method" REFTABLE="notification_installed" REFFIELDS="name" />
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_friend">
            <FIELDS>
                <FIELD NAME="user1" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="user2" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
               <KEY NAME="primary" TYPE="primary" FIELDS="user1,user2" />
               <KEY NAME="user1fk" TYPE="foreign" FIELDS="user1" REFTABLE="usr" REFFIELDS="id" />
               <KEY NAME="user2fk" TYPE="foreign" FIELDS="user2" REFTABLE="usr" REFFIELDS="id" />
            </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" />
                <FIELD NAME="reason" TYPE="text" NOTNULL="false" />
            </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" />
                <FIELD NAME="email" TYPE="text" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_password_request">
            <FIELDS>
                <FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="expiry" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="code" TYPE="char" LENGTH="20" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="user,expiry" />
                <KEY NAME="foreign" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>         
        </TABLE>
        <TABLE NAME="usr_suspension">
            <FIELDS>
                <FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="reason" TYPE="text" NOTNULL="false" />
                <FIELD NAME="cuser" TYPE="int" LENGTH="10" NOTNULL="false" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="user,ctime" />
                <KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="cuserfk" TYPE="foreign" FIELDS="cuser" REFTABLE="usr" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="template_category">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="false" />
                <FIELD NAME="name" TYPE="text" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="parentfk" TYPE="foreign" FIELDS="parent" REFTABLE="template_category" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="template">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="name" TYPE="text" NOTNULL="true" />
                <FIELD NAME="title" TYPE="text" NOTNULL="true" />
                <FIELD NAME="description" TYPE="text" NOTNULL="false" />
                <FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="categoryfk" TYPE="foreign" FIELDS="category" REFTABLE="template_category" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <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" />
                <FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="template" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
                <FIELD NAME="submitted" TYPE="int" LENGTH="10" NOTNULL="false" />
                <FIELD NAME="public" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
                <FIELD NAME="loggedin" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
                <FIELD NAME="friendsonly" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="ownerfk" TYPE="foreign" FIELDS="owner" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="templatefk" TYPE="foreign" FIELDS="template" REFTABLE="template" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="view_artefact">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="block" TYPE="text" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
                <!--more? -->
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="viewartuk" TYPE="unique" FIELDS="view,artefact" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
                <KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="view_content">
            <FIELDS>
                <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="content" TYPE="text" NOTNULL="true" />
                <FIELD NAME="block" TYPE="text" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="id" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="view_access_community">
            <FIELDS>
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="community" TYPE="int" LENGTH="10" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="view,community" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
                <KEY NAME="communityfk" TYPE="foreign" FIELDS="community" REFTABLE="community" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="view_access_group">
            <FIELDS>
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="group" TYPE="int" LENGTH="10" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="view,group" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
                <KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="usr_group" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="view_access_user">
            <FIELDS>
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="view,user" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
                <KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
            </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" />
                <!--- 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" />
582
                <FIELD NAME="mauthor" TYPE="int" LENGTH="10" NOTNULL="false" />
Penny Leach's avatar
Penny Leach committed
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636
            </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_artefact">
            <FIELDS>
                <FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="user,artefact" />
                <KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="artefactfk" TYPE="foreign" FIELDS="artefact" REFTABLE="artefact" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_watchlist_view">
            <FIELDS>
                <FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="user,view" />
                <KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="usr_watchlist_community">
            <FIELDS>
                <FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="community" TYPE="int" LENGTH="10" NOTNULL="true" />
                <FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="user,community" />
                <KEY NAME="userfk" TYPE="foreign" FIELDS="user" REFTABLE="usr" REFFIELDS="id" />
                <KEY NAME="communityfk" TYPE="foreign" FIELDS="community" REFTABLE="community" REFFIELDS="id" />
            </KEYS>
        </TABLE>
        <TABLE NAME="institution">
            <FIELDS>
                <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="displayname" TYPE="char" LENGTH="255" NOTNULL="true" />
                <FIELD NAME="plugin" TYPE="char" LENGTH="255" NOTNULL="true" />
            </FIELDS>
            <KEYS>
                <KEY NAME="primary" TYPE="primary" FIELDS="name" />
                <KEY NAME="pluginfk" TYPE="foreign" FIELDS="plugin" REFTABLE="auth_installed" REFFIELDS="name" />
            </KEYS>
        </TABLE>
637
    </TABLES>
638
    <STATEMENTS>
639
        <STATEMENT NAME="insert config" TYPE="insert" TABLE="config">
640 641 642 643
            <SENTENCES>
                <SENTENCE TEXT="(field, value) VALUES ('session_timeout', 1800)" />
            </SENTENCES>
        </STATEMENT>
644
        <STATEMENT NAME="insert root user" TYPE="insert" TABLE="usr">
645
            <SENTENCES>
646
                <SENTENCE TEXT="(username, password, passwordchange, firstname, lastname, email) VALUES ('root', 'mahara', 1, 'Admin', 'User', 'admin@example.com')"/>
647 648
            </SENTENCES>
        </STATEMENT>
Penny Leach's avatar
Penny Leach committed
649
        <STATEMENT NAME="insert event types" TYPE="insert" TABLE="event_type">
650 651 652 653 654
            <SENTENCES>
                <SENTENCE TEXT="(name) VALUES ('createuser')" />
                <SENTENCE TEXT="(name) VALUES ('updateuser')" />
                <SENTENCE TEXT="(name) VALUES ('suspenduser')" />
                <SENTENCE TEXT="(name) VALUES ('deleteuser')" />
655
            </SENTENCES>
656
        </STATEMENT>
Penny Leach's avatar
Penny Leach committed
657 658
        <STATEMENT NAME="insert activity types" TYPE="insert" TABLE="activity_type">
            <SENTENCES>
659 660 661 662 663 664 665 666 667
                <SENTENCE TEXT="(name, admin, delay) VALUES ('maharamessage', 0, 0)" />
                <SENTENCE TEXT="(name, admin, delay) VALUES ('usermessage', 0, 0)" />
                <SENTENCE TEXT="(name, admin, delay) VALUES ('feedback', 0, 0)" />
                <SENTENCE TEXT="(name, admin, delay) VALUES ('watchlist', 0, 1)" />
                <SENTENCE TEXT="(name, admin, delay) VALUES ('newview', 0, 1)" />
                <SENTENCE TEXT="(name, admin, delay) VALUES ('contactus', 1, 1)" />
                <SENTENCE TEXT="(name, admin, delay) VALUES ('objectionable', 1, 1)" />
                <SENTENCE TEXT="(name, admin, delay) VALUES ('virusrepeat', 1, 1)" />
                <SENTENCE TEXT="(name, admin, delay) VALUES ('virusrelease', 1, 1)" />
Penny Leach's avatar
Penny Leach committed
668 669
            </SENTENCES>
        </STATEMENT>
670
    </STATEMENTS>
671
</XMLDB>