Don't create cards_abiduri it if already exists

Signed-off-by: Louis Chemineau <louis@chmn.me>
pull/31221/head
Louis Chemineau 3 years ago committed by Louis (Rebase PR Action)
parent c9ea2363b1
commit 970fb7ce65
  1. 14
      core/Command/Db/AddMissingIndices.php

@ -258,11 +258,15 @@ class AddMissingIndices extends Command {
$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');
}
}
}

Loading…
Cancel
Save