From 0272f33552fcfeecfdf940b66ba26c599ad3a4c5 Mon Sep 17 00:00:00 2001 From: Philipp Memmel Date: Wed, 12 Mar 2025 14:59:06 +0100 Subject: [PATCH] MDL-84844 core_course: Add index to course_sections for mod_subsection --- lib/db/install.xml | 3 ++- lib/db/upgrade.php | 12 ++++++++++++ version.php | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/db/install.xml b/lib/db/install.xml index 13561092232..bc1ecafb53c 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -395,6 +395,7 @@ + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 0cd63e63eb5..65977bbb916 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1592,5 +1592,17 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2025030600.08); } + if ($oldversion < 2025031200) { + // Add index for querying delegated sections. + $table = new xmldb_table('course_sections'); + $index = new xmldb_index('component_itemid', XMLDB_INDEX_NOTUNIQUE, ['component', 'itemid']); + + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + // Main savepoint reached. + upgrade_main_savepoint(true, 2025031200); + } + return true; } diff --git a/version.php b/version.php index 5684f5e87ec..9168656f2fd 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2025031100.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2025031200.00; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '5.0dev+ (Build: 20250311)'; // Human-friendly version name