diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2025-03-12 13:05:37 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2025-04-23 22:49:35 +0000 |
commit | f0c508384a7d77686fb45e2387f603711bad8fce (patch) | |
tree | 4859e1e9d3a7fa400d8f0d2e539263ec1e67255b | |
parent | 344e282039a08049dfdc52bcd7ebe63aa62cb641 (diff) | |
download | nextcloud-server-backport/51439/stable30.tar.gz nextcloud-server-backport/51439/stable30.zip |
fix(db): Create replacement index where original index is missingbackport/51439/stable30
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rw-r--r-- | core/Command/Db/AddMissingIndices.php | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 285b9330281..4d0624ba8a7 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('<info>Removing ' . $oldIndexName . ' index from the ' . $table->getName() . ' table</info>'); - $table->dropIndex($oldIndexName); + if ($table->hasIndex($oldIndexName)) { + $output->writeln('<info>Removing ' . $oldIndexName . ' index from the ' . $table->getName() . ' table</info>'); + $table->dropIndex($oldIndexName); + } } if (!$dryRun) { |