diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-08-01 21:27:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-01 21:27:09 +0200 |
commit | e750137a9ae695f2d9daa5188bf66709da1561fc (patch) | |
tree | 1c78589ef3af7f3c748fa89d4e0d0ca99dab5b51 | |
parent | f74e89bde5892a68500eeea3fa98a511b1d7f7e9 (diff) | |
parent | 047cc708d45f5dee07e986a1d6cf538049edd36c (diff) | |
download | nextcloud-server-e750137a9ae695f2d9daa5188bf66709da1561fc.tar.gz nextcloud-server-e750137a9ae695f2d9daa5188bf66709da1561fc.zip |
Merge pull request #33405 from nextcloud/perf/new-index-mounts-class
-rw-r--r-- | core/Application.php | 7 | ||||
-rw-r--r-- | core/Command/Db/AddMissingIndices.php | 13 | ||||
-rw-r--r-- | core/Migrations/Version24000Date20220202150027.php | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/core/Application.php b/core/Application.php index 443585ebc79..158375984d1 100644 --- a/core/Application.php +++ b/core/Application.php @@ -225,6 +225,13 @@ class Application extends App { $subject->addHintForMissingSubject($table->getName(), 'preferences_app_key'); } } + + if ($schema->hasTable('mounts')) { + $table = $schema->getTable('mounts'); + if (!$table->hasIndex('mounts_class_index')) { + $subject->addHintForMissingSubject($table->getName(), 'mounts_class_index'); + } + } } ); diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 957c5251454..5799a462ffa 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -444,6 +444,19 @@ class AddMissingIndices extends Command { } } + $output->writeln('<info>Check indices of the oc_mounts table.</info>'); + if ($schema->hasTable('mounts')) { + $table = $schema->getTable('mounts'); + if (!$table->hasIndex('mounts_class_index')) { + $output->writeln('<info>Adding mounts_class_index index to the oc_mounts table, this can take some time...</info>'); + + $table->addIndex(['mount_provider_class'], 'mounts_class_index'); + $this->connection->migrateToSchema($schema->getWrappedSchema()); + $updated = true; + $output->writeln('<info>oc_mounts table updated successfully.</info>'); + } + } + if (!$updated) { $output->writeln('<info>Done.</info>'); } diff --git a/core/Migrations/Version24000Date20220202150027.php b/core/Migrations/Version24000Date20220202150027.php index 76a3ae8c73c..6a3f5ad2faf 100644 --- a/core/Migrations/Version24000Date20220202150027.php +++ b/core/Migrations/Version24000Date20220202150027.php @@ -30,6 +30,7 @@ class Version24000Date20220202150027 extends SimpleMigrationStep { 'notnull' => false, 'length' => 128, ]); + $table->addIndex(['mount_provider_class'], 'mounts_class_index'); return $schema; } return null; |