aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2025-03-12 13:05:37 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2025-04-17 17:59:19 +0200
commit29161c0dfd81b42fed81659984ed1f0e84a4ec1f (patch)
tree08aa45d318b1039534ae0dec22e883a7a60dc1b4
parentf34466c99e10a5972598a4a352c25e61ad2fc306 (diff)
downloadnextcloud-server-fix/create-missing-replacement-indexes.tar.gz
nextcloud-server-fix/create-missing-replacement-indexes.zip
fix(db): Create replacement index where original index is missingfix/create-missing-replacement-indexes
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rw-r--r--core/Command/Db/AddMissingIndices.php15
1 files changed, 5 insertions, 10 deletions
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('<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) {