Skip to content

Commit

Permalink
Merge pull request #31221 from nextcloud/feat/dont_create_oc_cards_in…
Browse files Browse the repository at this point in the history
…dex_if_it_exists

Don't create cards_abiduri it if already exists
  • Loading branch information
PVince81 authored Mar 24, 2022
2 parents 114af08 + 970fb7c commit 04d4666
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 @@ -258,11 +258,15 @@ private function addCoreIndexes(OutputInterface $output, bool $dryRun): void {
$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 04d4666

Please sign in to comment.