MDL-10990 4) added missing indexes into data module; merged from MOODLE_19_STABLE

This commit is contained in:
skodak 2008-02-26 22:04:23 +00:00
parent 656418b179
commit 25322ba36f
3 changed files with 32 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/data/db" VERSION="20070814" COMMENT="XMLDB file for Moodle mod/data"
<XMLDB PATH="mod/data/db" VERSION="20080226" COMMENT="XMLDB file for Moodle mod/data"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
@ -38,8 +38,11 @@
<FIELD NAME="notification" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" ENUM="false" COMMENT="Notify people when things change" PREVIOUS="editany"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
</INDEXES>
</TABLE>
<TABLE NAME="data_fields" COMMENT="every field available" PREVIOUS="data" NEXT="data_records">
<FIELDS>
@ -63,6 +66,9 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="dataid"/>
<KEY NAME="dataid" TYPE="foreign" FIELDS="dataid" REFTABLE="data" REFFIELDS="id" PREVIOUS="primary"/>
</KEYS>
<INDEXES>
<INDEX NAME="type-dataid" UNIQUE="false" FIELDS="type, dataid" COMMENT="used by data linking filter"/>
</INDEXES>
</TABLE>
<TABLE NAME="data_records" COMMENT="every record introduced" PREVIOUS="data_fields" NEXT="data_content">
<FIELDS>
@ -138,4 +144,4 @@
</SENTENCES>
</STATEMENT>
</STATEMENTS>
</XMLDB>
</XMLDB>

View File

@ -74,6 +74,28 @@ function xmldb_data_upgrade($oldversion=0) {
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2007081402) {
/// Define index type-dataid (not unique) to be added to data_fields
$table = new XMLDBTable('data_fields');
$index = new XMLDBIndex('type-dataid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('type', 'dataid'));
/// Launch add index type-dataid
if (!index_exists($table, $index)) {
$result = $result && add_index($table, $index);
}
/// Define index course (not unique) to be added to data
$table = new XMLDBTable('data');
$index = new XMLDBIndex('course');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('course'));
/// Launch add index course
if (!index_exists($table, $index)) {
$result = $result && add_index($table, $index);
}
}
return $result;
}

View File

@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2007081400;
$module->version = 2007081402;
$module->requires = 2007101000; // Requires this Moodle version
$module->cron = 60;