MDL-63280 core: correct index on upgrade vs install
authorMark Nelson <markn@moodle.com>
Fri, 26 Oct 2018 00:52:27 +0000 (08:52 +0800)
committerMark Nelson <markn@moodle.com>
Fri, 26 Oct 2018 00:52:27 +0000 (08:52 +0800)
lib/db/install.xml
lib/db/upgrade.php

index d78f754..6835116 100644 (file)
       <INDEXES>
         <INDEX NAME="type" UNIQUE="false" FIELDS="type"/>
         <INDEX NAME="convhash" UNIQUE="false" FIELDS="convhash"/>
-        <INDEX NAME="component-itemtype-contextid-itemid" UNIQUE="false" FIELDS="component, itemtype, contextid, itemid"/>
+        <INDEX NAME="component-itemtype-itemid-contextid" UNIQUE="false" FIELDS="component, itemtype, itemid, contextid"/>
       </INDEXES>
     </TABLE>
     <TABLE NAME="message_conversation_members" COMMENT="Stores all members in a conversations">
index 40924a1..2aa8774 100644 (file)
@@ -2643,7 +2643,7 @@ function xmldb_main_upgrade($oldversion) {
         $dbman->add_key($table, $key);
 
         // Add index.
-        $index = new xmldb_index('component-itemtype-contextid-itemid', XMLDB_INDEX_NOTUNIQUE, ['component', 'itemtype',
+        $index = new xmldb_index('component-itemtype-itemid-contextid', XMLDB_INDEX_NOTUNIQUE, ['component', 'itemtype',
             'itemid', 'contextid']);
         if (!$dbman->index_exists($table, $index)) {
             $dbman->add_index($table, $index);