Skip to content

Commit

Permalink
fix(settings): show warning for indexToReplace as part of missing ind…
Browse files Browse the repository at this point in the history
…ices

Signed-off-by: Johannes Merkel <[email protected]>
  • Loading branch information
JohannesGGE authored and backportbot[bot] committed Apr 5, 2024
1 parent 02a6310 commit 8b614a9
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 8b614a9

Please sign in to comment.