MDL-86601 core_task: Add index for scheduled task lastruntime

This commit is contained in:
Benjamin Walker
2026-01-30 22:54:06 +10:00
parent 502f469b5d
commit dac9930a58
3 changed files with 16 additions and 1 deletions
+1
View File
@@ -3501,6 +3501,7 @@
</KEYS>
<INDEXES>
<INDEX NAME="classname_uniq" UNIQUE="true" FIELDS="classname"/>
<INDEX NAME="lastruntime_nextruntime" UNIQUE="false" FIELDS="lastruntime, nextruntime"/>
</INDEXES>
</TABLE>
<TABLE NAME="task_adhoc" COMMENT="List of adhoc tasks waiting to run.">
+14
View File
@@ -1684,5 +1684,19 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2026013000.01);
}
if ($oldversion < 2026013000.02) {
// Define index lastruntime_nextruntime (not unique) to be added to task_scheduled.
$table = new xmldb_table('task_scheduled');
$index = new xmldb_index('lastruntime_nextruntime', XMLDB_INDEX_NOTUNIQUE, ['lastruntime', 'nextruntime']);
// Conditionally launch add index lastruntime_nextruntime.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2026013000.02);
}
return true;
}
+1 -1
View File
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2026013000.01; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2026013000.02; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '5.2dev (Build: 20260130)'; // Human-friendly version name