Commit 3262330d authored by Pau Ferrer's avatar Pau Ferrer
Browse files

MDL-50805 Messages: Add index to message_read to speed up message crons

parent 3377cbc3
......@@ -565,6 +565,7 @@
<INDEXES>
<INDEX NAME="useridfrom" UNIQUE="false" FIELDS="useridfrom"/>
<INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
<INDEX NAME="notificationtimeread" UNIQUE="false" FIELDS="notification, timeread"/>
</INDEXES>
</TABLE>
<TABLE NAME="message_contacts" COMMENT="Maintains lists of relationships between users">
......
......@@ -4151,5 +4151,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2014111007.07);
}
if ($oldversion < 2014111008.03) {
// Define index notification (not unique) to be added to message_read.
$table = new xmldb_table('message_read');
$index = new xmldb_index('notificationtimeread', XMLDB_INDEX_NOTUNIQUE, array('notification', 'timeread'));
// Conditionally launch add index notification.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014111008.03);
}
return true;
}
......@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2014111008.02; // 20141110 = branching date YYYYMMDD - do not modify!
$version = 2014111008.03; // 20141110 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment