From 5ea613c99b1b555b52170e43b512b0c8377ec210 Mon Sep 17 00:00:00 2001 From: Alex Rowe Date: Fri, 24 Sep 2021 15:25:09 +1000 Subject: [PATCH] MDL-57980 grade_items: add mdl_grade_items index New index created on itemtype, itemmodule, iteminstance and courseid --- lib/db/install.xml | 3 ++- lib/db/upgrade.php | 15 +++++++++++++++ version.php | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/db/install.xml b/lib/db/install.xml index eeb1af648de..1a1d98e5e39 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -1917,6 +1917,7 @@ + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index f6919eb54d5..7213adfda5a 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2862,5 +2862,20 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2021092400.03); } + if ($oldversion < 2021100500.00) { + // Define index itemtype-mod-inst-course (not unique) to be added to grade_items. + $table = new xmldb_table('grade_items'); + $index = new xmldb_index('itemtype-mod-inst-course', XMLDB_INDEX_NOTUNIQUE, + ['itemtype', 'itemmodule', 'iteminstance', 'courseid']); + + // Conditionally launch add index itemtype-mod-inst-course. + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + // Main savepoint reached. + upgrade_main_savepoint(true, 2021100500.00); + } + return true; } diff --git a/version.php b/version.php index e59cc0b730b..0277afdcf22 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2021100300.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2021100500.00; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.0dev (Build: 20211003)'; // Human-friendly version name