Skip to content

Commit

Permalink
Don't create cards_abiduri it if already exists
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Feb 17, 2022
1 parent 1bfd001 commit f2a0614
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 f2a0614

Please sign in to comment.