Merge branch 'MDL-86601-adhoc-index-MOODLE_500_STABLE' of https://github.com/bwalkerl/moodle into MOODLE_500_STABLE

This commit is contained in:
Safat
2026-02-02 12:13:00 +11:00
2 changed files with 31 additions and 1 deletions
+3 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20251205" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20251208" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@@ -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.">
@@ -3523,6 +3524,7 @@
<INDEXES>
<INDEX NAME="nextruntime_idx" UNIQUE="false" FIELDS="nextruntime"/>
<INDEX NAME="timestarted_idx" UNIQUE="false" FIELDS="timestarted"/>
<INDEX NAME="nextruntime_classname" UNIQUE="false" FIELDS="nextruntime, classname"/>
</INDEXES>
</TABLE>
<TABLE NAME="task_log" COMMENT="The log table for all tasks">
+28
View File
@@ -1952,5 +1952,33 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2025041404.06);
}
if ($oldversion < 2025041404.08) {
// Define index nextruntime_classname (not unique) to be added to task_adhoc.
$table = new xmldb_table('task_adhoc');
$index = new xmldb_index('nextruntime_classname', XMLDB_INDEX_NOTUNIQUE, ['nextruntime', 'classname']);
// Conditionally launch add index nextruntime_classname.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Main savepoint reached.
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;
}