Merge pull request #44306 from nextcloud/settings/show-indextoreplace-warning

fix(settings): show warning for indexToReplace as part of missing indices
pull/44676/head^2
Anna 2 months ago committed by GitHub
commit f63c0cf921
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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