From 29161c0dfd81b42fed81659984ed1f0e84a4ec1f Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 12 Mar 2025 13:05:37 +0100 Subject: fix(db): Create replacement index where original index is missing Signed-off-by: Christoph Wurst --- core/Command/Db/AddMissingIndices.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'core/Command') diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index ec36400d291..eec0aedce11 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -86,14 +86,7 @@ class AddMissingIndices extends Command { if ($schema->hasTable($toReplaceIndex['tableName'])) { $table = $schema->getTable($toReplaceIndex['tableName']); - $allOldIndicesExists = true; - foreach ($toReplaceIndex['oldIndexNames'] as $oldIndexName) { - if (!$table->hasIndex($oldIndexName)) { - $allOldIndicesExists = false; - } - } - - if (!$allOldIndicesExists) { + if ($table->hasIndex($toReplaceIndex['newIndexName'])) { continue; } @@ -110,8 +103,10 @@ class AddMissingIndices extends Command { } foreach ($toReplaceIndex['oldIndexNames'] as $oldIndexName) { - $output->writeln('Removing ' . $oldIndexName . ' index from the ' . $table->getName() . ' table'); - $table->dropIndex($oldIndexName); + if ($table->hasIndex($oldIndexName)) { + $output->writeln('Removing ' . $oldIndexName . ' index from the ' . $table->getName() . ' table'); + $table->dropIndex($oldIndexName); + } } if (!$dryRun) { -- cgit v1.2.3