Skip to content

Commit

Permalink
Merge pull request #44675 from nextcloud/backport/44306/stable29
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Jun 7, 2024
2 parents 0c8e34e + 8b614a9 commit 39adc5f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private function getMissingIndices(): array {
$event = new AddMissingIndicesEvent();
$this->dispatcher->dispatchTyped($event);
$missingIndices = $event->getMissingIndices();
$indicesToReplace = $event->getIndicesToReplace();

if (!empty($missingIndices)) {
$schema = new SchemaWrapper($this->connection);
Expand All @@ -69,6 +70,18 @@ private function getMissingIndices(): array {
}
}

if (!empty($indicesToReplace)) {
$schema = new SchemaWrapper($this->connection);
foreach ($indicesToReplace as $indexToReplace) {
if ($schema->hasTable($indexToReplace['tableName'])) {
$table = $schema->getTable($indexToReplace['tableName']);
if (!$table->hasIndex($indexToReplace['newIndexName'])) {
$indexInfo->addHintForMissingIndex($indexToReplace['tableName'], $indexToReplace['newIndexName']);
}
}
}
}

return $indexInfo->getListOfMissingIndices();
}

Expand Down

0 comments on commit 39adc5f

Please sign in to comment.