diff --git a/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php b/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php index ccf6bbb52d0ec..bd33f513b56b6 100644 --- a/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php +++ b/apps/settings/lib/SetupChecks/DatabaseHasMissingIndices.php @@ -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); @@ -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(); }