Skip to content

Commit

Permalink
MDL-34933 core_message: Adding index to improve database access on me…
Browse files Browse the repository at this point in the history
…ssage_working table.
  • Loading branch information
Mike Churchward committed Apr 22, 2013
1 parent 931eff3 commit d75a987
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" PREVIOUS="message_working" NEXT="files_reference">
<FIELDS>
Expand Down
14 changes: 14 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -1687,5 +1687,19 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012120303.02);
}

if ($oldversion < 2012120303.06) {
// 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, 2012120303.06);
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();


$version = 2012120303.05; // 20121203 = branching date YYYYMMDD - do not modify!
$version = 2012120303.06; // 20121203 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

Expand Down

0 comments on commit d75a987

Please sign in to comment.