Skip to content

Commit

Permalink
MDL-80943 reportbuilder: Fix bad conflict resolution.
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyatregubov committed Mar 8, 2024
1 parent 82859f1 commit 96c9fd4
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/db/upgrade.php
Expand Up @@ -1106,26 +1106,28 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2024030500.01);
}

if ($oldversion < 2024030500.02) {
}

if ($oldversion < 2024030500.02) {

// Get all "select" custom field shortnames.
$fieldshortnames = $DB->get_fieldset('customfield_field', 'shortname', ['type' => 'select']);
// Get all "select" custom field shortnames.
$fieldshortnames = $DB->get_fieldset('customfield_field', 'shortname', ['type' => 'select']);

// Ensure any used in custom reports columns are not using integer type aggregation.
foreach ($fieldshortnames as $fieldshortname) {
$DB->execute("
// Ensure any used in custom reports columns are not using integer type aggregation.
foreach ($fieldshortnames as $fieldshortname) {
$DB->execute("
UPDATE {reportbuilder_column}
SET aggregation = NULL
WHERE " . $DB->sql_like('uniqueidentifier', ':uniqueidentifier', false) . "
AND aggregation IN ('avg', 'max', 'min', 'sum')
", [
'uniqueidentifier' => '%' . $DB->sql_like_escape(":customfield_{$fieldshortname}"),
]);
}

// Main savepoint reached.
upgrade_main_savepoint(true, 2024030500.02);
'uniqueidentifier' => '%' . $DB->sql_like_escape(":customfield_{$fieldshortname}"),
]);
}

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

return true;
}

0 comments on commit 96c9fd4

Please sign in to comment.