mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Merge pull request #51439 from nextcloud/fix/create-missing-replacement-indexes
fix(db): Create replacement index where original index is missing
This commit is contained in:
commit
2c8c036bdb
1 changed files with 5 additions and 10 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue