<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20060808" COMMENT="XMLDB file for core Moodle tables">
+<XMLDB PATH="lib/db" VERSION="20060810" COMMENT="XMLDB file for core Moodle tables">
<TABLES>
<TABLE NAME="config" COMMENT="Moodle configuration variables" NEXT="config_plugins">
<FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for role"/>
</KEYS>
+ <INDEXES>
+ <INDEX NAME="sortorder" UNIQUE="false" FIELDS="sortorder"/>
+ </INDEXES>
</TABLE>
- <TABLE NAME="context" COMMENT="one of these must be set" PREVIOUS="role" NEXT="role_assignments">
+ <TABLE NAME="context" COMMENT="one of these must be set" PREVIOUS="role" NEXT="capabilities">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="level"/>
<FIELD NAME="level" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="instanceid"/>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for context"/>
</KEYS>
+ <INDEXES>
+ <INDEX NAME="level-instanceid" UNIQUE="true" FIELDS="level, instanceid" NEXT="instanceid"/>
+ <INDEX NAME="instanceid" UNIQUE="false" FIELDS="instanceid" PREVIOUS="level-instanceid"/>
+ </INDEXES>
+ </TABLE>
+ <TABLE NAME="capabilities" COMMENT="this defines all capabilities" PREVIOUS="context" NEXT="role_assignments">
+ <FIELDS>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="name"/>
+ <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="captype"/>
+ <FIELD NAME="captype" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="contextlevel"/>
+ <FIELD NAME="contextlevel" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="captype" NEXT="component"/>
+ <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="contextlevel"/>
+ </FIELDS>
+ <KEYS>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for capabilities" NEXT="name"/>
+ <KEY NAME="name" TYPE="unique" FIELDS="name" PREVIOUS="primary"/>
+ </KEYS>
</TABLE>
- <TABLE NAME="role_assignments" COMMENT="assigning roles to different context" PREVIOUS="context" NEXT="role_capabilities">
+ <TABLE NAME="role_assignments" COMMENT="assigning roles to different context" PREVIOUS="capabilities" NEXT="role_capabilities">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="roleid"/>
<FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="contextid"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="enrol"/>
</FIELDS>
<KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for role_assignments"/>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for role_assignments" NEXT="roleid"/>
+ <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id" PREVIOUS="primary" NEXT="contextid"/>
+ <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id" PREVIOUS="roleid" NEXT="userid"/>
+ <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" PREVIOUS="contextid"/>
</KEYS>
+ <INDEXES>
+ <INDEX NAME="contextid-roleid-userid" UNIQUE="true" FIELDS="contextid, roleid, userid" NEXT="sortorder"/>
+ <INDEX NAME="sortorder" UNIQUE="false" FIELDS="sortorder" PREVIOUS="contextid-roleid-userid"/>
+ </INDEXES>
</TABLE>
<TABLE NAME="role_capabilities" COMMENT="overriding a capability for a particular role in a particular context" PREVIOUS="role_assignments" NEXT="role_deny_grant">
<FIELDS>
<FIELD NAME="modifierid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timemodified"/>
</FIELDS>
<KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for role_capabilities"/>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for role_capabilities" NEXT="roleid"/>
+ <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id" PREVIOUS="primary" NEXT="contextid"/>
+ <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id" PREVIOUS="roleid" NEXT="modifierid"/>
+ <KEY NAME="modifierid" TYPE="foreign" FIELDS="modifierid" REFTABLE="user" REFFIELDS="id" PREVIOUS="contextid" NEXT="capability"/>
+ <KEY NAME="capability" TYPE="foreign" FIELDS="capability" REFTABLE="capabilities" REFFIELDS="name" PREVIOUS="modifierid"/>
</KEYS>
+ <INDEXES>
+ <INDEX NAME="roleid-contextid-capability" UNIQUE="true" FIELDS="roleid, contextid, capability"/>
+ </INDEXES>
</TABLE>
- <TABLE NAME="role_deny_grant" COMMENT="this defines what role can touch (assign, override) what role" PREVIOUS="role_capabilities" NEXT="capabilities">
+ <TABLE NAME="role_deny_grant" COMMENT="this defines what role can touch (assign, override) what role" PREVIOUS="role_capabilities" NEXT="role_names">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="roleid"/>
<FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="unviewableroleid"/>
<FIELD NAME="unviewableroleid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="roleid"/>
</FIELDS>
<KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for role_deny_grant"/>
- </KEYS>
- </TABLE>
- <TABLE NAME="capabilities" COMMENT="this defines all capabilities" PREVIOUS="role_deny_grant" NEXT="role_names">
- <FIELDS>
- <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="name"/>
- <FIELD NAME="name" TYPE="char" LENGTH="150" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="captype"/>
- <FIELD NAME="captype" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="contextlevel"/>
- <FIELD NAME="contextlevel" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="captype" NEXT="component"/>
- <FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="contextlevel"/>
- </FIELDS>
- <KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for capabilities"/>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for role_deny_grant" NEXT="roleid"/>
+ <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id" PREVIOUS="primary" NEXT="unviewableroleid"/>
+ <KEY NAME="unviewableroleid" TYPE="foreign" FIELDS="unviewableroleid" REFTABLE="role" REFFIELDS="id" PREVIOUS="roleid"/>
</KEYS>
+ <INDEXES>
+ <INDEX NAME="roleid-unviewableroleid" UNIQUE="true" FIELDS="roleid, unviewableroleid"/>
+ </INDEXES>
</TABLE>
- <TABLE NAME="role_names" COMMENT="role names in native strings" PREVIOUS="capabilities">
+ <TABLE NAME="role_names" COMMENT="role names in native strings" PREVIOUS="role_deny_grant">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="roleid"/>
<FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="contextid"/>
<FIELD NAME="text" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="contextid"/>
</FIELDS>
<KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for role_names"/>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for role_names" NEXT="roleid"/>
+ <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id" COMMENT="Default comment for the key, please edit me" PREVIOUS="primary" NEXT="contextid"/>
+ <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id" PREVIOUS="roleid"/>
</KEYS>
+ <INDEXES>
+ <INDEX NAME="roleid-contextid" UNIQUE="true" FIELDS="roleid, contextid"/>
+ </INDEXES>
</TABLE>
</TABLES>
<STATEMENTS>