summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2022-02-16 18:42:14 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2022-03-28 10:47:29 +0000
commited3e37f3c1fbc88c0067149dca5b729badd5861a (patch)
treecc81ce674a6166fe4a6a8492ba92008e274bb3b1 /core
parent988236b9aebe8c6c7aa483c44c6eee365e243f33 (diff)
downloadnextcloud-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.php14
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');
+ }
}
}