diff options
author | Louis Chemineau <louis@chmn.me> | 2022-02-16 18:42:14 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2022-03-28 10:47:29 +0000 |
commit | ed3e37f3c1fbc88c0067149dca5b729badd5861a (patch) | |
tree | cc81ce674a6166fe4a6a8492ba92008e274bb3b1 /core | |
parent | 988236b9aebe8c6c7aa483c44c6eee365e243f33 (diff) | |
download | nextcloud-server-ed3e37f3c1fbc88c0067149dca5b729badd5861a.tar.gz nextcloud-server-ed3e37f3c1fbc88c0067149dca5b729badd5861a.zip |
Don't create cards_abiduri it if already exists
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/Db/AddMissingIndices.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 4c86a8705db..1a484dfc806 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -222,11 +222,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'); + } } } |