Skip to content

Commit

Permalink
Merge pull request #141 from jwalits/MOODLE_401_STABLE
Browse files Browse the repository at this point in the history
[#140] Add index for dialogueid for performance improvement
  • Loading branch information
danmarsden authored Dec 10, 2024
2 parents ee40096 + a19e22a commit c0969e1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<INDEXES>
<INDEX NAME="authorid" UNIQUE="false" FIELDS="authorid"/>
<INDEX NAME="conversationid" UNIQUE="false" FIELDS="conversationid"/>
<INDEX NAME="dialogueid" UNIQUE="false" FIELDS="dialogueid"/>
</INDEXES>
</TABLE>
<TABLE NAME="dialogue_flags" COMMENT="Flags set against a dialogue, conversation or message e.g read">
Expand Down
18 changes: 18 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,23 @@
* @return bool
*/
function xmldb_dialogue_upgrade($oldversion) {
global $DB;

$dbman = $DB->get_manager();

if ($oldversion < 2024120900) {
// Define index dialogueid (not unique) to be added to dialogue_messages.
$table = new xmldb_table('dialogue_messages');
$index = new xmldb_index('dialogueid', XMLDB_INDEX_NOTUNIQUE, ['dialogueid']);

// Conditionally launch add index userid.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}

// savepoint reached.
upgrade_mod_savepoint(true, 2024120900, 'dialogue');
}

return true;
}
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*/
defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024100901;
$plugin->release = 2024100901;
$plugin->version = 2024120900;
$plugin->release = 2024120900;
$plugin->requires = 2022112805; // Requires 4.1 or higher.
$plugin->component = 'mod_dialogue'; // Full name of the plugin (used for diagnostics).
$plugin->maturity = MATURITY_STABLE; // This version's maturity level.
Expand Down

0 comments on commit c0969e1

Please sign in to comment.