Skip to content

Commit

Permalink
Merge pull request #31733 from nextcloud/backport/31221/stable23
Browse files Browse the repository at this point in the history
[stable23] Don't create cards_abiduri it if already exists
  • Loading branch information
artonge authored Mar 29, 2022
2 parents 1c0e871 + ed3e37f commit dd4b300
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions core/Command/Db/AddMissingIndices.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,15 @@ private function addCoreIndexes(OutputInterface $output) {
$table = $schema->getTable('cards');

if ($table->hasIndex('addressbookid_uri_index')) {
$output->writeln('<info>Renaming addressbookid_uri_index index to to the cards table, this can take some time...</info>');

foreach ($table->getIndexes() as $index) {
if ($index->getColumns() === ['addressbookid', 'uri']) {
$table->renameIndex('addressbookid_uri_index', 'cards_abiduri');
if ($table->hasIndex('cards_abiduri')) {
$table->dropIndex('addressbookid_uri_index');
} else {
$output->writeln('<info>Renaming addressbookid_uri_index index to cards_abiduri in the cards table, this can take some time...</info>');

foreach ($table->getIndexes() as $index) {
if ($index->getColumns() === ['addressbookid', 'uri']) {
$table->renameIndex('addressbookid_uri_index', 'cards_abiduri');
}
}
}

Expand Down

0 comments on commit dd4b300

Please sign in to comment.