diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-12-10 16:32:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-10 16:32:13 +0300 |
commit | ccd5ca54762db358dece2c8e917310ad680063d3 (patch) | |
tree | 01c8cfd352a581d5b939211e9d05530c8197445a /core/Command/Db | |
parent | 3c693db0ca770fccd5521ecdc4da6d77ae966a73 (diff) | |
parent | 36ffad5ba7e62783f3fb4073a6eedf1c0ca645b9 (diff) |
Merge pull request #23044 from nextcloud/migration-10.5
Handle owncloud migration to latest release
Diffstat (limited to 'core/Command/Db')
-rw-r--r-- | core/Command/Db/AddMissingIndices.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index d06f27e8449..49fc16b079a 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -200,8 +200,23 @@ class AddMissingIndices extends Command { } $output->writeln('<info>Check indices of the cards table.</info>'); + $cardsUpdated = false; if ($schema->hasTable('cards')) { $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'); + } + } + + $this->connection->migrateToSchema($schema->getWrappedSchema()); + $cardsUpdated = true; + } + if (!$table->hasIndex('cards_abid')) { $output->writeln('<info>Adding cards_abid index to the cards table, this can take some time...</info>'); @@ -213,6 +228,24 @@ class AddMissingIndices extends Command { $table->addIndex(['addressbookid'], 'cards_abid'); $this->connection->migrateToSchema($schema->getWrappedSchema()); + $cardsUpdated = true; + } + + if (!$table->hasIndex('cards_abiduri')) { + $output->writeln('<info>Adding cards_abiduri index to the cards table, this can take some time...</info>'); + + foreach ($table->getIndexes() as $index) { + if ($index->getColumns() === ['addressbookid', 'uri']) { + $table->dropIndex($index->getName()); + } + } + + $table->addIndex(['addressbookid', 'uri'], 'cards_abiduri'); + $this->connection->migrateToSchema($schema->getWrappedSchema()); + $cardsUpdated = true; + } + + if ($cardsUpdated) { $updated = true; $output->writeln('<info>cards table updated successfully.</info>'); } |