Skip to content

Commit

Permalink
Add uid_owner and uid_initiator share tabe indices
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Oct 1, 2018
1 parent 28eaacd commit b82cbe0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ function(GenericEvent $event) use ($container) {
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')) {
Expand Down
16 changes: 16 additions & 0 deletions core/Command/Db/AddMissingIndices.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@ private function addShareTableIndicies(OutputInterface $output) {
$updated = true;
$output->writeln('<info>Share table updated successfully.</info>');
}

if (!$table->hasIndex('uid_owner')) {
$output->writeln('<info>Adding additional owner index to the share table, this can take some time...</info>');
$table->addIndex(['uid_owner'], 'owner_index');
$this->connection->migrateToSchema($schema->getWrappedSchema());
$updated = true;
$output->writeln('<info>Share table updated successfully.</info>');
}

if (!$table->hasIndex('uid_initiator')) {
$output->writeln('<info>Adding additional initiator index to the share table, this can take some time...</info>');
$table->addIndex(['uid_initiator'], 'initiator_index');
$this->connection->migrateToSchema($schema->getWrappedSchema());
$updated = true;
$output->writeln('<info>Share table updated successfully.</info>');
}
}

if ($schema->hasTable('filecache')) {
Expand Down
2 changes: 2 additions & 0 deletions core/Migrations/Version13000Date20170718121200.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
$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')) {
Expand Down

0 comments on commit b82cbe0

Please sign in to comment.