]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add missing index for propertypath only queries against properties 30435/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Thu, 23 Dec 2021 10:34:51 +0000 (11:34 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 29 Dec 2021 09:57:54 +0000 (09:57 +0000)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
core/Application.php
core/Command/Db/AddMissingIndices.php
core/Migrations/Version13000Date20170718121200.php

index a6c64e81b84d64eba98dbcab24a1824729a1d034..77cd221bb83f3dbf1db24d08f4fb8ae572b87be6 100644 (file)
@@ -187,6 +187,9 @@ class Application extends App {
                                        if (!$table->hasIndex('properties_path_index')) {
                                                $subject->addHintForMissingSubject($table->getName(), 'properties_path_index');
                                        }
+                                       if (!$table->hasIndex('properties_pathonly_index')) {
+                                               $subject->addHintForMissingSubject($table->getName(), 'properties_pathonly_index');
+                                       }
                                }
                        }
                );
index 1acff55fa40a2f78018fd28b438387a1079c8d58..824c7073bd3fac54eb98f0da2029459dbad051ae 100644 (file)
@@ -301,11 +301,24 @@ class AddMissingIndices extends Command {
                $output->writeln('<info>Check indices of the oc_properties table.</info>');
                if ($schema->hasTable('properties')) {
                        $table = $schema->getTable('properties');
+                       $propertiesUpdated = false;
+
                        if (!$table->hasIndex('properties_path_index')) {
                                $output->writeln('<info>Adding properties_path_index index to the oc_properties table, this can take some time...</info>');
 
                                $table->addIndex(['userid', 'propertypath'], 'properties_path_index');
                                $this->connection->migrateToSchema($schema->getWrappedSchema());
+                               $propertiesUpdated = true;
+                       }
+                       if (!$table->hasIndex('properties_pathonly_index')) {
+                               $output->writeln('<info>Adding properties_pathonly_index index to the oc_properties table, this can take some time...</info>');
+
+                               $table->addIndex(['propertypath'], 'properties_pathonly_index');
+                               $this->connection->migrateToSchema($schema->getWrappedSchema());
+                               $propertiesUpdated = true;
+                       }
+
+                       if ($propertiesUpdated) {
                                $updated = true;
                                $output->writeln('<info>oc_properties table updated successfully.</info>');
                        }
index 4912bef885738cb899b6dbabd861fcc2eacc978f..b020effe5aa791153799448b9b35a277514f946b 100644 (file)
@@ -357,6 +357,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
                        $table->setPrimaryKey(['id']);
                        $table->addIndex(['userid'], 'property_index');
                        $table->addIndex(['userid', 'propertypath'], 'properties_path_index');
+                       $table->addIndex(['propertypath'], 'properties_pathonly_index');
                } else {
                        $table = $schema->getTable('properties');
                        if ($table->hasColumn('propertytype')) {