Skip to content

Commit dd4b300

Browse files
authored
Merge pull request #31733 from nextcloud/backport/31221/stable23
[stable23] Don't create cards_abiduri it if already exists
2 parents 1c0e871 + ed3e37f commit dd4b300

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

core/Command/Db/AddMissingIndices.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,15 @@ private function addCoreIndexes(OutputInterface $output) {
222222
$table = $schema->getTable('cards');
223223

224224
if ($table->hasIndex('addressbookid_uri_index')) {
225-
$output->writeln('<info>Renaming addressbookid_uri_index index to to the cards table, this can take some time...</info>');
226-
227-
foreach ($table->getIndexes() as $index) {
228-
if ($index->getColumns() === ['addressbookid', 'uri']) {
229-
$table->renameIndex('addressbookid_uri_index', 'cards_abiduri');
225+
if ($table->hasIndex('cards_abiduri')) {
226+
$table->dropIndex('addressbookid_uri_index');
227+
} else {
228+
$output->writeln('<info>Renaming addressbookid_uri_index index to cards_abiduri in the cards table, this can take some time...</info>');
229+
230+
foreach ($table->getIndexes() as $index) {
231+
if ($index->getColumns() === ['addressbookid', 'uri']) {
232+
$table->renameIndex('addressbookid_uri_index', 'cards_abiduri');
233+
}
230234
}
231235
}
232236

0 commit comments

Comments
 (0)