Skip to content

Commit

Permalink
MDL-48108 core: Add new indexes to message tables
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Feb 24, 2015
1 parent b5e9faa commit 8b52863
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/db/install.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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"
>
Expand Down Expand Up @@ -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">
Expand All @@ -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">
Expand Down Expand Up @@ -3096,4 +3098,4 @@
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>
24 changes: 24 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 8b52863

Please sign in to comment.