Skip to content

Commit 2db36ad

Browse files
committed
Add index to oc_properties
Signed-off-by: Mario Danic <mario@lovelyhq.com>
1 parent 80222e6 commit 2db36ad

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

composer.phar

1.88 MB
Binary file not shown.

core/Command/Db/AddMissingIndices.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* @author Robin Appelman <robin@icewind.nl>
1212
* @author Roeland Jago Douma <roeland@famdouma.nl>
1313
* @author Thomas Citharel <nextcloud@tcit.fr>
14+
* @author Mario Danic <mario@lovelyhq.com>
1415
*
1516
* @license GNU AGPL version 3 or any later version
1617
*
@@ -254,6 +255,19 @@ private function addCoreIndexes(OutputInterface $output) {
254255
}
255256
}
256257

258+
$output->writeln('<info>Check indices of the oc_properties table.</info>');
259+
if ($schema->hasTable('oc_properties')) {
260+
$table = $schema->getTable('oc_properties');
261+
if (!$table->hasIndex('properties_path_index')) {
262+
$output->writeln('<info>Adding properties_path_index index to the oc_properties table, this can take some time...</info>');
263+
264+
$table->addIndex(['userid', 'propertypath'], 'properties_path_index');
265+
$this->connection->migrateToSchema($schema->getWrappedSchema());
266+
$updated = true;
267+
$output->writeln('<info>oc_properties table updated successfully.</info>');
268+
}
269+
}
270+
257271
if (!$updated) {
258272
$output->writeln('<info>Done.</info>');
259273
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace OC\Core\Migrations;
6+
7+
use Closure;
8+
use OCP\DB\ISchemaWrapper;
9+
use OCP\Migration\IOutput;
10+
use OCP\Migration\SimpleMigrationStep;
11+
12+
class Version19000Date20200429140134 extends SimpleMigrationStep {
13+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
14+
/** @var ISchemaWrapper $schema */
15+
$schema = $schemaClosure();
16+
17+
if ($schema->hasTable('oc_properties')) {
18+
$table = $schema->getTable('oc_properties');
19+
$table->addIndex(['userid', 'propertypath'], 'properties_path_index');
20+
}
21+
return $schema;
22+
}
23+
}

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@
860860
'OC\\Core\\Migrations\\Version18000Date20191014105105' => $baseDir . '/core/Migrations/Version18000Date20191014105105.php',
861861
'OC\\Core\\Migrations\\Version18000Date20191204114856' => $baseDir . '/core/Migrations/Version18000Date20191204114856.php',
862862
'OC\\Core\\Migrations\\Version19000Date20200211083441' => $baseDir . '/core/Migrations/Version19000Date20200211083441.php',
863+
'OC\\Core\\Migrations\\Version19000Date20200429140134' => $baseDir . '/core/Migrations/Version19000Date20200429140134.php',
863864
'OC\\Core\\Notification\\RemoveLinkSharesNotifier' => $baseDir . '/core/Notification/RemoveLinkSharesNotifier.php',
864865
'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php',
865866
'OC\\DB\\Adapter' => $baseDir . '/lib/private/DB/Adapter.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
889889
'OC\\Core\\Migrations\\Version18000Date20191014105105' => __DIR__ . '/../../..' . '/core/Migrations/Version18000Date20191014105105.php',
890890
'OC\\Core\\Migrations\\Version18000Date20191204114856' => __DIR__ . '/../../..' . '/core/Migrations/Version18000Date20191204114856.php',
891891
'OC\\Core\\Migrations\\Version19000Date20200211083441' => __DIR__ . '/../../..' . '/core/Migrations/Version19000Date20200211083441.php',
892+
'OC\\Core\\Migrations\\Version19000Date20200429140134' => __DIR__ . '/../../..' . '/core/Migrations/Version19000Date20200429140134.php',
892893
'OC\\Core\\Notification\\RemoveLinkSharesNotifier' => __DIR__ . '/../../..' . '/core/Notification/RemoveLinkSharesNotifier.php',
893894
'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php',
894895
'OC\\DB\\Adapter' => __DIR__ . '/../../..' . '/lib/private/DB/Adapter.php',

0 commit comments

Comments
 (0)