From b82cbe04df59805e50d3762e6205c777aeff90a9 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 1 Oct 2018 23:59:36 +0200 Subject: [PATCH] Add uid_owner and uid_initiator share tabe indices Signed-off-by: Roeland Jago Douma --- core/Application.php | 6 ++++++ core/Command/Db/AddMissingIndices.php | 16 ++++++++++++++++ .../Version13000Date20170718121200.php | 2 ++ 3 files changed, 24 insertions(+) diff --git a/core/Application.php b/core/Application.php index 336538187d..5a8b6be089 100644 --- a/core/Application.php +++ b/core/Application.php @@ -70,6 +70,12 @@ class Application extends App { if (!$table->hasIndex('parent_index')) { $subject->addHintForMissingSubject($table->getName(), 'parent_index'); } + if (!$table->hasIndex('uid_owner')) { + $subject->addHintForMissingSubject($table->getName(), 'uid_owner'); + } + if (!$table->hasIndex('uid_initiator')) { + $subject->addHintForMissingSubject($table->getName(), 'uid_initiator'); + } } if ($schema->hasTable('filecache')) { diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 5d78d360b4..c2068b3691 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -98,6 +98,22 @@ class AddMissingIndices extends Command { $updated = true; $output->writeln('Share table updated successfully.'); } + + if (!$table->hasIndex('uid_owner')) { + $output->writeln('Adding additional owner index to the share table, this can take some time...'); + $table->addIndex(['uid_owner'], 'owner_index'); + $this->connection->migrateToSchema($schema->getWrappedSchema()); + $updated = true; + $output->writeln('Share table updated successfully.'); + } + + if (!$table->hasIndex('uid_initiator')) { + $output->writeln('Adding additional initiator index to the share table, this can take some time...'); + $table->addIndex(['uid_initiator'], 'initiator_index'); + $this->connection->migrateToSchema($schema->getWrappedSchema()); + $updated = true; + $output->writeln('Share table updated successfully.'); + } } if ($schema->hasTable('filecache')) { diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index 29687b8683..0b2c255738 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -403,6 +403,8 @@ class Version13000Date20170718121200 extends SimpleMigrationStep { $table->addIndex(['token'], 'token_index'); $table->addIndex(['share_with'], 'share_with_index'); $table->addIndex(['parent'], 'parent_index'); + $table->addIndex(['uid_owner'], 'owner_index'); + $table->addIndex(['uid_initiator'], 'initiator_index'); } if (!$schema->hasTable('jobs')) {