Browse files

MDL-34933 core_message: Adding index to improve database access on me…

…ssage_working table.
  • Loading branch information...
1 parent b3661ab commit d750d41e66583ce2b10decc5c6f7bde9cecf724d @mchurchward mchurchward committed Apr 17, 2013
Showing with 18 additions and 1 deletion.
  1. +3 −0 lib/db/install.xml
  2. +14 −0 lib/db/upgrade.php
  3. +1 −1 version.php
View
3 lib/db/install.xml
@@ -2363,6 +2363,9 @@
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me"/>
</KEYS>
+ <INDEXES>
+ <INDEX NAME="unreadmessageid_idx" UNIQUE="false" FIELDS="unreadmessageid" COMMENT="Index on unreadmessage id"/>
+ </INDEXES>
</TABLE>
<TABLE NAME="files" COMMENT="description of files, content is stored in sha1 file pool">
<FIELDS>
View
14 lib/db/upgrade.php
@@ -1990,5 +1990,19 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2013040300.01);
}
+ if ($oldversion < 2013041100.01) {
+ // Adding index to unreadmessageid field of message_working table (MDL-34933)
+ $table = new xmldb_table('message_working');
+ $index = new xmldb_index('unreadmessageid_idx', XMLDB_INDEX_NOTUNIQUE, array('unreadmessageid'));
+
+ // Conditionally launch add index unreadmessageid
+ if (!$dbman->index_exists($table, $index)) {
+ $dbman->add_index($table, $index);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2013041100.01);
+ }
+
return true;
}
View
2 version.php
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2013041100.00; // YYYYMMDD = weekly release date of this DEV branch
+$version = 2013041100.01; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

0 comments on commit d750d41

Please sign in to comment.