MDL-86601 core_task: Add index for scheduled task lastruntime

This commit is contained in:
Benjamin Walker
2026-01-30 22:52:20 +10:00
parent 4a2cf5131b
commit 226aee577d
2 changed files with 15 additions and 0 deletions
+1
View File
@@ -3498,6 +3498,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
@@ -1966,5 +1966,19 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2025041404.08);
}
if ($oldversion < 2025041404.09) {
// 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, 2025041404.09);
}
return true;
}