Skip to content

Commit

Permalink
MDL-71438 blocks: Add index on mdl_user_preferences.name
Browse files Browse the repository at this point in the history
  • Loading branch information
golenkovm committed Jun 2, 2021
1 parent 30b8ad5 commit ee3c6ad
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@
</KEYS>
<INDEXES>
<INDEX NAME="userid-name" UNIQUE="true" FIELDS="userid, name"/>
<INDEX NAME="name" UNIQUE="false" FIELDS="name"/>
</INDEXES>
</TABLE>
<TABLE NAME="user_lastaccess" COMMENT="To keep track of course page access times, used in online participants block, and participants list">
Expand Down
15 changes: 15 additions & 0 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2650,5 +2650,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2021052500.90);
}

if ($oldversion < 2021060300.00) {

// Define index name (not unique) to be added to user_preferences.
$table = new xmldb_table('user_preferences');
$index = new xmldb_index('name', XMLDB_INDEX_NOTUNIQUE, ['name']);

// Conditionally launch add index name.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}

// Main savepoint reached.
upgrade_main_savepoint(true, 2021060300.00);
}

return true;
}
1 change: 1 addition & 0 deletions lib/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ information provided here is intended especially for developers.
* The block template now includues a block-instanceid data attribute.
* The core/event::getLegacyEvents() function has been deprecated and should no longer be used.
* Typo3 has now been removed. Use native mbstring or iconv functions.
* A new index has been added on mdl_user_preferences.name. This upgrade step might take some time on big sites.

=== 3.11 ===
* PHPUnit has been upgraded to 9.5 (see MDL-71036 for details).
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

defined('MOODLE_INTERNAL') || die();

$version = 2021052700.00; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2021060300.00; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.0dev (Build: 20210527)'; // Human-friendly version name
Expand Down

0 comments on commit ee3c6ad

Please sign in to comment.