From 94e6b5ef150d42bbe57ca28c0ea7c193966afe92 Mon Sep 17 00:00:00 2001 From: Jwalit Shah Date: Mon, 9 Dec 2024 12:08:25 +1100 Subject: [PATCH 1/2] [#140] Add index for dialogueid for performance improvement --- db/install.xml | 1 + db/upgrade.php | 18 ++++++++++++++++++ version.php | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/db/install.xml b/db/install.xml index 6291f86..38050b1 100755 --- a/db/install.xml +++ b/db/install.xml @@ -91,6 +91,7 @@ + diff --git a/db/upgrade.php b/db/upgrade.php index 01022ad..415bdc6 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -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; } diff --git a/version.php b/version.php index 063cade..a2f21d2 100644 --- a/version.php +++ b/version.php @@ -23,7 +23,7 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024100901; +$plugin->version = 2024120900; $plugin->release = 2024100901; $plugin->requires = 2022112805; // Requires 4.1 or higher. $plugin->component = 'mod_dialogue'; // Full name of the plugin (used for diagnostics). From a19e22af0d30cdb4a3f7f075cc7ec71bacdcda59 Mon Sep 17 00:00:00 2001 From: Jwalit Shah Date: Tue, 10 Dec 2024 08:30:13 +1100 Subject: [PATCH 2/2] [#140] Bump release version --- version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.php b/version.php index a2f21d2..dbbe610 100644 --- a/version.php +++ b/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->version = 2024120900; -$plugin->release = 2024100901; +$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.