Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-02-07 11:55:39 +0300
committerJulius Härtl <jus@bitgrid.net>2022-04-19 13:37:36 +0300
commit7fbd93b2ad66a1ca83ef2a2778128bf2cda06caf (patch)
tree17fb8d130769954261661643c07a3ea46d0e2355 /core
parentcd95fce105fe5f0e71b1bcac7685464f936b9749 (diff)
Additional index on oc_preferences to make sure that gettingh values without a user filter is fast
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'core')
-rw-r--r--core/Application.php7
-rw-r--r--core/Command/Db/AddMissingIndices.php13
-rw-r--r--core/Migrations/Version13000Date20170718121200.php1
3 files changed, 21 insertions, 0 deletions
diff --git a/core/Application.php b/core/Application.php
index 545588ab208..f5c39a20013 100644
--- a/core/Application.php
+++ b/core/Application.php
@@ -213,6 +213,13 @@ class Application extends App {
$subject->addHintForMissingSubject($table->getName(), 'direct_edit_timestamp');
}
}
+
+ if ($schema->hasTable('preferences')) {
+ $table = $schema->getTable('preferences');
+ if (!$table->hasIndex('preferences_app_key')) {
+ $subject->addHintForMissingSubject($table->getName(), 'preferences_app_key');
+ }
+ }
}
);
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php
index a4379ffacc3..8394e75e845 100644
--- a/core/Command/Db/AddMissingIndices.php
+++ b/core/Command/Db/AddMissingIndices.php
@@ -435,6 +435,19 @@ class AddMissingIndices extends Command {
}
}
+ $output->writeln('<info>Check indices of the oc_preferences table.</info>');
+ if ($schema->hasTable('preferences')) {
+ $table = $schema->getTable('preferences');
+ if (!$table->hasIndex('preferences_app_key')) {
+ $output->writeln('<info>Adding preferences_app_key index to the oc_preferences table, this can take some time...</info>');
+
+ $table->addIndex(['appid', 'configkey'], 'preferences_app_key');
+ $this->connection->migrateToSchema($schema->getWrappedSchema());
+ $updated = true;
+ $output->writeln('<info>oc_properties table updated successfully.</info>');
+ }
+ }
+
if (!$updated) {
$output->writeln('<info>Done.</info>');
}
diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php
index 02864830b2c..3e14b4af47a 100644
--- a/core/Migrations/Version13000Date20170718121200.php
+++ b/core/Migrations/Version13000Date20170718121200.php
@@ -333,6 +333,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
'notnull' => false,
]);
$table->setPrimaryKey(['userid', 'appid', 'configkey']);
+ $table->addIndex(['appid', 'configkey'], 'preferences_app_key');
}
if (!$schema->hasTable('properties')) {