MDL-69760 core: add mdl_event index for assign adhoc tasks

This commit is contained in:
Justin Merrill 2020-10-07 10:05:29 -04:00
parent 5ecd01fb19
commit b80d65e45a
3 changed files with 28 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20200911" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20201007" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@ -464,8 +464,8 @@
<INDEX NAME="type-timesort" UNIQUE="false" FIELDS="type, timesort"/>
<INDEX NAME="groupid-courseid-categoryid-visible-userid" UNIQUE="false" FIELDS="groupid, courseid, categoryid, visible, userid" COMMENT="used for calendar view"/>
<INDEX NAME="eventtype" UNIQUE="false" FIELDS="eventtype"/>
<INDEX NAME="modulename-instance" UNIQUE="false" FIELDS="modulename, instance"/>
<INDEX NAME="component" UNIQUE="false" FIELDS="component, eventtype, instance"/>
<INDEX NAME="modulename-instance-eventtype" UNIQUE="false" FIELDS="modulename, instance, eventtype" COMMENT="Improve performance on assign adhoc tasks."/>
</INDEXES>
</TABLE>
<TABLE NAME="cache_filters" COMMENT="For keeping information about cached data">
@ -4301,4 +4301,4 @@
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>

View File

@ -2708,5 +2708,29 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2021052500.15);
}
if ($oldversion < 2021052500.20) {
// Define index modulename-instance-eventtype (not unique) to be added to event.
$table = new xmldb_table('event');
$index = new xmldb_index('modulename-instance-eventtype', XMLDB_INDEX_NOTUNIQUE, ['modulename', 'instance', 'eventtype']);
// Conditionally launch add index modulename-instance-eventtype.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Define index modulename-instance (not unique) to be dropped form event.
$table = new xmldb_table('event');
$index = new xmldb_index('modulename-instance', XMLDB_INDEX_NOTUNIQUE, ['modulename', 'instance']);
// Conditionally launch drop index modulename-instance.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2021052500.20);
}
return true;
}

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2021052500.19; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2021052500.20; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.0dev (Build: 20201006)'; // Human-friendly version name