Some notes:

- Foreign keys are really cool (at the XMLDB Editor). Define them as necessary
  as they allow as one "formal" structure of the DB. They won't cause problems
  on generation, mainly because only the underlying index will be created.
- Please, put comments inside each table/field/key/index field, mainly because
  XML comments will be deleted if the file is edited by
- The XMLDB Editor. Please use it ;-)
- Also, one unique index was wrong in the XML file, fixed now.
This commit is contained in:
stronk7
2006-09-25 21:37:29 +00:00
parent 4834fe627b
commit a653016d94
+10 -15
View File
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/wiki/db" VERSION="20060812" COMMENT="XMLDB file for Moodle mod/wiki">
<XMLDB PATH="mod/wiki/db" VERSION="20060925" COMMENT="XMLDB file for Moodle mod/wiki"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="wiki" COMMENT="Main wik table" NEXT="wiki_entries">
<FIELDS>
@@ -66,9 +69,6 @@
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for wiki_pages" NEXT="wiki"/>
<!-- sam notes: if implemented, this foreign key will break, since the
field defaults to 0 not null and will therefore fail to find its
referent. -->
<KEY NAME="wiki" TYPE="foreign" FIELDS="wiki" REFTABLE="wiki" REFFIELDS="id" PREVIOUS="primary"/>
</KEYS>
<INDEXES>
@@ -77,25 +77,20 @@
</TABLE>
<TABLE NAME="wiki_locks" COMMENT="Stores editing locks on Wiki pages" PREVIOUS="wiki_pages">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="wikiid"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="wikiid"/>
<FIELD NAME="wikiid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="pagename"/>
<FIELD NAME="pagename" TYPE="char" LENGTH="160" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="wikiid" NEXT="lockedby"/>
<!-- If the page is or was locked, this field holds the userid of the locker -->
<FIELD NAME="lockedby" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="pagename" NEXT='lockedsince'/>
<!-- Time (seconds since epoch) at which lock began -->
<FIELD NAME="lockedsince" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lockedby" NEXT='lockedseen'/>
<!-- Time (seconds since epoch) at which lock was last reconfirmed (we ignore lock if this is >2 mins ago) -->
<FIELD NAME="lockedseen" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lockedsince"/>
<FIELD NAME="lockedby" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="If the page is or was locked, this field holds the userid of the locker" PREVIOUS="pagename" NEXT="lockedsince"/>
<FIELD NAME="lockedsince" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Time (seconds since epoch) at which lock began" PREVIOUS="lockedby" NEXT="lockedseen"/>
<FIELD NAME="lockedseen" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Time (seconds since epoch) at which lock was last reconfirmed (we ignore lock if this is &amp;gt;2 mins ago)" PREVIOUS="lockedsince"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for wiki_locks" NEXT="wikiid"/>
<KEY NAME="wikiid" TYPE="foreign" FIELDS="wikiid" REFTABLE="wiki" REFFIELDS="id" PREVIOUS="primary"/>
</KEYS>
<INDEXES>
<!-- Main index used for retrieving locks -->
<INDEX NAME="wikiid-pagename" UNIQUE="false" FIELDS="wikiid,pagename" NEXT="lockedseen"/>
<!-- Secondary index used only during cron for deleting expired locks -->
<INDEX NAME="lockedseen" UNIQUE="false" FIELDS="lockedseen" PREVIOUS="wikiid-pagename"/>
<INDEX NAME="wikiid-pagename" UNIQUE="true" FIELDS="wikiid, pagename" COMMENT="Main index used for retrieving locks" NEXT="lockedseen"/>
<INDEX NAME="lockedseen" UNIQUE="false" FIELDS="lockedseen" COMMENT="Secondary index used only during cron for deleting expired locks" PREVIOUS="wikiid-pagename"/>
</INDEXES>
</TABLE>
</TABLES>