Add context.path and context.depth fields for accesslib optimisation

This commit is contained in:
martinlanghoff 2007-08-09 06:14:21 +00:00
parent 6f4cea05d2
commit c7c57cfbf2
3 changed files with 26 additions and 4 deletions

View file

@ -846,14 +846,18 @@
<FIELDS> <FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="contextlevel"/> <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="contextlevel"/>
<FIELD NAME="contextlevel" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="instanceid"/> <FIELD NAME="contextlevel" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="instanceid"/>
<FIELD NAME="instanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="contextlevel"/> <FIELD NAME="instanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="contextlevel" NEXT="path"/>
<FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="instanceid" NEXT="depth"/>
<FIELD NAME="depth" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="path"/>
</FIELDS> </FIELDS>
<KEYS> <KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for context"/> <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for context"/>
</KEYS> </KEYS>
<INDEXES> <INDEXES>
<INDEX NAME="contextlevel-instanceid" UNIQUE="true" FIELDS="contextlevel, instanceid" NEXT="instanceid"/> <INDEX NAME="contextlevel-instanceid" UNIQUE="true" FIELDS="contextlevel, instanceid" NEXT="instanceid"/>
<INDEX NAME="instanceid" UNIQUE="false" FIELDS="instanceid" PREVIOUS="contextlevel-instanceid"/> <INDEX NAME="instanceid" UNIQUE="false" FIELDS="instanceid" PREVIOUS="contextlevel-instanceid" NEXT="path"/>
<INDEX NAME="path" UNIQUE="false" FIELDS="path" PREVIOUS="instanceid"/>
</INDEXES> </INDEXES>
</TABLE> </TABLE>
<TABLE NAME="context_rel" COMMENT="context relations, c2 is a parent (or higher) of c1" PREVIOUS="context" NEXT="capabilities"> <TABLE NAME="context_rel" COMMENT="context relations, c2 is a parent (or higher) of c1" PREVIOUS="context" NEXT="capabilities">

View file

@ -1634,6 +1634,24 @@ function xmldb_main_upgrade($oldversion=0) {
$result = $result && change_field_precision($table, $field); $result = $result && change_field_precision($table, $field);
} }
if ($result && $oldversion < 2007080900) {
/// Add context.path & index
$table = new XMLDBTable('context');
$field = new XMLDBField('path');
$field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, '', 'instanceid');
$result = $result && add_field($table, $field);
$table = new XMLDBTable('context');
$index = new XMLDBIndex('path');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('path'));
$result = $result && add_index($table, $index);
/// Add context.depth
$table = new XMLDBTable('context');
$field = new XMLDBField('depth');
$field->setAttributes(XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'path');
$result = $result && add_field($table, $field);
}
/* /*
/// drop old gradebook tables /// drop old gradebook tables
if ($result && $oldversion < 2007072209) { if ($result && $oldversion < 2007072209) {

View file

@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine // This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php) // whether upgrades should be performed (see lib/db/*.php)
$version = 2007080800; // YYYYMMDD = date $version = 2007080900; // YYYYMMDD = date
// XY = increments within a single day // XY = increments within a single day
$release = '1.9 dev'; // Human-friendly version name $release = '1.9 dev'; // Human-friendly version name