Commit 98be2d20 authored by Ryan Wyllie's avatar Ryan Wyllie
Browse files

MDL-57370 message: change indexes on message tables

parent 4d146f1a
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20161119" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20170207" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
......@@ -545,8 +545,9 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
<INDEX NAME="useridfromtodeleted" UNIQUE="false" FIELDS="useridfrom, useridto, timeuserfromdeleted, timeusertodeleted"/>
<INDEX NAME="useridfrom_timeuserfromdeleted_notification" UNIQUE="false" FIELDS="useridfrom, timeuserfromdeleted, notification"/>
<INDEX NAME="useridto_timeusertodeleted_notification" UNIQUE="false" FIELDS="useridto, timeusertodeleted, notification"/>
</INDEXES>
</TABLE>
<TABLE NAME="message_read" COMMENT="Stores all messages that have been read">
......@@ -573,9 +574,10 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
<INDEX NAME="useridfromtodeleted" UNIQUE="false" FIELDS="useridfrom, useridto, timeuserfromdeleted, timeusertodeleted"/>
<INDEX NAME="notificationtimeread" UNIQUE="false" FIELDS="notification, timeread"/>
<INDEX NAME="useridfrom_timeuserfromdeleted_notification" UNIQUE="false" FIELDS="useridfrom, timeuserfromdeleted, notification"/>
<INDEX NAME="useridto_timeusertodeleted_notification" UNIQUE="false" FIELDS="useridto, timeusertodeleted, notification"/>
</INDEXES>
</TABLE>
<TABLE NAME="message_contacts" COMMENT="Maintains lists of relationships between users">
......
......@@ -2465,5 +2465,65 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2016122800.00);
}
if ($oldversion < 2017020200.01) {
// Define index useridfrom_timeuserfromdeleted_notification (not unique) to be added to message.
$table = new xmldb_table('message');
$index = new xmldb_index('useridfrom_timeuserfromdeleted_notification', XMLDB_INDEX_NOTUNIQUE, array('useridfrom', 'timeuserfromdeleted', 'notification'));
// Conditionally launch add index useridfrom_timeuserfromdeleted_notification.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Define index useridto_timeusertodeleted_notification (not unique) to be added to message.
$index = new xmldb_index('useridto_timeusertodeleted_notification', XMLDB_INDEX_NOTUNIQUE, array('useridto', 'timeusertodeleted', 'notification'));
// Conditionally launch add index useridto_timeusertodeleted_notification.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
$index = new xmldb_index('useridto', XMLDB_INDEX_NOTUNIQUE, array('useridto'));
// Conditionally launch drop index useridto.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2017020200.01);
}
if ($oldversion < 2017020200.02) {
// Define index useridfrom_timeuserfromdeleted_notification (not unique) to be added to message_read.
$table = new xmldb_table('message_read');
$index = new xmldb_index('useridfrom_timeuserfromdeleted_notification', XMLDB_INDEX_NOTUNIQUE, array('useridfrom', 'timeuserfromdeleted', 'notification'));
// Conditionally launch add index useridfrom_timeuserfromdeleted_notification.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Define index useridto_timeusertodeleted_notification (not unique) to be added to message_read.
$index = new xmldb_index('useridto_timeusertodeleted_notification', XMLDB_INDEX_NOTUNIQUE, array('useridto', 'timeusertodeleted', 'notification'));
// Conditionally launch add index useridto_timeusertodeleted_notification.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
$index = new xmldb_index('useridto', XMLDB_INDEX_NOTUNIQUE, array('useridto'));
// Conditionally launch drop index useridto.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2017020200.02);
}
return true;
}
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="message/output/popup/db" VERSION="20160729" COMMENT="XMLDB file for Moodle message/output/popup"
<XMLDB PATH="message/output/popup/db" VERSION="20161221" COMMENT="XMLDB file for Moodle message/output/popup"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
>
......@@ -15,6 +15,7 @@
</KEYS>
<INDEXES>
<INDEX NAME="messageid-isread" UNIQUE="true" FIELDS="messageid, isread"/>
<INDEX NAME="isread" UNIQUE="false" FIELDS="isread"/>
</INDEXES>
</TABLE>
</TABLES>
......
......@@ -74,5 +74,20 @@ function xmldb_message_popup_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016122100) {
// Define index isread (not unique) to be added to message_popup.
$table = new xmldb_table('message_popup');
$index = new xmldb_index('isread', XMLDB_INDEX_NOTUNIQUE, array('isread'));
// Conditionally launch add index isread.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Popup savepoint reached.
upgrade_plugin_savepoint(true, 2016122100, 'message', 'popup');
}
return true;
}
......@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016120500; // The current plugin version (Date: YYYYMMDDXX)
$plugin->version = 2016122100; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2016112900; // Requires this Moodle version
$plugin->component = 'message_popup'; // Full name of the plugin (used for diagnostics)
......@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2017020200.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2017020200.02; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
......
Supports Markdown
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