summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-03-24 17:12:21 +0100
committerGitHub <noreply@github.com>2022-03-24 17:12:21 +0100
commit04d4666c37a98f969813d0d43ceed007a6a6c391 (patch)
treee6260fd3ae4b528d006377a4e75cd5248159b8d3
parent114af08043d77dd4feca93ea1d56a0506cbfec47 (diff)
parent970fb7ce655245f653869ad52291f8d22d78e4d4 (diff)
downloadnextcloud-server-04d4666c37a98f969813d0d43ceed007a6a6c391.tar.gz
nextcloud-server-04d4666c37a98f969813d0d43ceed007a6a6c391.zip
Merge pull request #31221 from nextcloud/feat/dont_create_oc_cards_index_if_it_exists
Don't create cards_abiduri it if already exists
-rw-r--r--core/Command/Db/AddMissingIndices.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php
index f1dba2f4c31..a4379ffacc3 100644
--- a/core/Command/Db/AddMissingIndices.php
+++ b/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');
+ }
}
}