fix(settings): show warning for indexToReplace as part of missing indices

Signed-off-by: Johannes Merkel <mail@johannesgge.de>
pull/44306/head
Johannes Merkel 2 months ago
parent 6101abbb2d
commit 33a0aa6994
No known key found for this signature in database

@ -56,6 +56,7 @@ class DatabaseHasMissingIndices implements ISetupCheck {
$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 @@ class DatabaseHasMissingIndices implements ISetupCheck {
}
}
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();
}

Loading…
Cancel
Save