MDL-36941 core: added index to 'message_user_actions' table

This commit is contained in:
Mark Nelson
2018-03-23 12:30:30 +08:00
parent 74ad60bfbe
commit 2ccbb8ed62
3 changed files with 18 additions and 1 deletions
+3
View File
@@ -648,6 +648,9 @@
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
<KEY NAME="messageid" TYPE="foreign" FIELDS="messageid" REFTABLE="messages" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="userid_messageid_action" UNIQUE="true" FIELDS="userid, messageid, action"/>
</INDEXES>
</TABLE>
<TABLE NAME="notifications" COMMENT="Stores all notifications">
<FIELDS>
+14
View File
@@ -2162,5 +2162,19 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2018032200.05);
}
if ($oldversion < 2018032200.06) {
// Define table 'message_user_actions' to add an index to.
$table = new xmldb_table('message_user_actions');
// Conditionally launch add index.
$index = new xmldb_index('userid_messageid_action', XMLDB_INDEX_UNIQUE, array('userid, messageid, action'));
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2018032200.06);
}
return true;
}
+1 -1
View File
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2018032200.05; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2018032200.06; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.