MDL-48108 core: Add new indexes to message tables

This commit is contained in:
Andrew Nicols 2015-02-19 14:13:32 +08:00
parent b5e9faa67e
commit 8b52863f0a
3 changed files with 29 additions and 3 deletions

6
lib/db/install.xml Normal file → Executable file
View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20150211" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20150219" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@ -541,6 +541,7 @@
<INDEXES>
<INDEX NAME="useridfrom" UNIQUE="false" FIELDS="useridfrom"/>
<INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
<INDEX NAME="useridfromto" UNIQUE="false" FIELDS="useridfrom, useridto"/>
</INDEXES>
</TABLE>
<TABLE NAME="message_read" COMMENT="Stores all messages that have been read">
@ -565,6 +566,7 @@
<INDEXES>
<INDEX NAME="useridfrom" UNIQUE="false" FIELDS="useridfrom"/>
<INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
<INDEX NAME="useridfromto" UNIQUE="false" FIELDS="useridfrom, useridto"/>
</INDEXES>
</TABLE>
<TABLE NAME="message_contacts" COMMENT="Maintains lists of relationships between users">
@ -3096,4 +3098,4 @@
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>

View File

@ -4177,5 +4177,29 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2015021100.00);
}
if ($oldversion < 2015021900.00) {
// Define index useridfromto (not unique) to be added to message.
$table = new xmldb_table('message');
$index = new xmldb_index('useridfromto', XMLDB_INDEX_NOTUNIQUE, array('useridfrom', 'useridto'));
// Conditionally launch add index useridfromto.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Define index useridfromto (not unique) to be added to message_read.
$table = new xmldb_table('message_read');
$index = new xmldb_index('useridfromto', XMLDB_INDEX_NOTUNIQUE, array('useridfrom', 'useridto'));
// Conditionally launch add index useridfromto.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2015021900.00);
}
return true;
}

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2015021900.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2015022400.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.