Skip to content

Commit 3abd033

Browse files
committed
Don't create cards_abiduri it if already exists
Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent 1bfd001 commit 3abd033

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 to 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)