aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-12-23 11:34:51 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-12-23 15:51:50 +0100
commited84f07784c2b991cd5adc95f94b04908564afd3 (patch)
tree8ac271208d4d2d0fdf70e6aa762117f32a1bff7f
parent29dffd7e7fc84faa6a4317c691c6cac9eaf42f42 (diff)
downloadnextcloud-server-ed84f07784c2b991cd5adc95f94b04908564afd3.tar.gz
nextcloud-server-ed84f07784c2b991cd5adc95f94b04908564afd3.zip
Add missing index for propertypath only queries against properties
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rw-r--r--core/Application.php3
-rw-r--r--core/Command/Db/AddMissingIndices.php13
-rw-r--r--core/Migrations/Version13000Date20170718121200.php1
3 files changed, 17 insertions, 0 deletions
diff --git a/core/Application.php b/core/Application.php
index 4e36d59baac..0f363f8c699 100644
--- a/core/Application.php
+++ b/core/Application.php
@@ -195,6 +195,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 57fa49149f6..4c86a8705db 100644
--- a/core/Command/Db/AddMissingIndices.php
+++ b/core/Command/Db/AddMissingIndices.php
@@ -316,11 +316,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 3d97ee1de39..02864830b2c 100644
--- a/core/Migrations/Version13000Date20170718121200.php
+++ b/core/Migrations/Version13000Date20170718121200.php
@@ -363,6 +363,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')) {