diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-12-23 13:34:51 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-12-29 12:57:50 +0300 |
commit | 6aa7507c05cb6bf88a9efd47bda4934f630f0c33 (patch) | |
tree | ffed1d87a93827bc4e05d986fd0fd86b7c06d934 /core | |
parent | ca5bf437fff6d0ce7bc7066dbfce099946aa9411 (diff) |
Add missing index for propertypath only queries against properties
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core')
-rw-r--r-- | core/Application.php | 3 | ||||
-rw-r--r-- | core/Command/Db/AddMissingIndices.php | 13 | ||||
-rw-r--r-- | core/Migrations/Version13000Date20170718121200.php | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/core/Application.php b/core/Application.php index 460a645f10c..8dd618c1d13 100644 --- a/core/Application.php +++ b/core/Application.php @@ -186,6 +186,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'); + } } if ($schema->hasTable('jobs')) { diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 79269a01f53..dceaed3c2c3 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -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>'); } diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index a6ff1cbfa94..629a0a1e9f2 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -358,6 +358,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')) { |