Merge pull request #20716 from nextcloud/index-propertypath

Add index to properties table
This commit is contained in:
Roeland Jago Douma 2020-05-01 12:39:34 +02:00 committed by GitHub
commit 80372a3ce1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 0 deletions

View File

@ -163,6 +163,13 @@ class Application extends App {
$subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index'); $subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index');
} }
} }
if ($schema->hasTable('properties')) {
$table = $schema->getTable('properties');
if (!$table->hasIndex('properties_path_index')) {
$subject->addHintForMissingSubject($table->getName(), 'properties_path_index');
}
}
} }
); );

View File

@ -11,6 +11,7 @@ declare(strict_types=1);
* @author Robin Appelman <robin@icewind.nl> * @author Robin Appelman <robin@icewind.nl>
* @author Roeland Jago Douma <roeland@famdouma.nl> * @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Thomas Citharel <nextcloud@tcit.fr> * @author Thomas Citharel <nextcloud@tcit.fr>
* @author Mario Danic <mario@lovelyhq.com>
* *
* @license GNU AGPL version 3 or any later version * @license GNU AGPL version 3 or any later version
* *
@ -254,6 +255,19 @@ class AddMissingIndices extends Command {
} }
} }
$output->writeln('<info>Check indices of the oc_properties table.</info>');
if ($schema->hasTable('properties')) {
$table = $schema->getTable('properties');
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());
$updated = true;
$output->writeln('<info>oc_properties table updated successfully.</info>');
}
}
if (!$updated) { if (!$updated) {
$output->writeln('<info>Done.</info>'); $output->writeln('<info>Done.</info>');
} }

View File

@ -318,6 +318,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
]); ]);
$table->setPrimaryKey(['id']); $table->setPrimaryKey(['id']);
$table->addIndex(['userid'], 'property_index'); $table->addIndex(['userid'], 'property_index');
$table->addIndex(['userid', 'propertypath'], 'properties_path_index');
} }
if (!$schema->hasTable('share')) { if (!$schema->hasTable('share')) {