Merge pull request #17445 from nextcloud/db/add-index-on-schedulingobjects

Add index on principaluri for schedulingobjects table
This commit is contained in:
Roeland Jago Douma 2019-10-08 19:26:32 +02:00 committed by GitHub
commit c0827cfb1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

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

View File

@ -234,6 +234,19 @@ class AddMissingIndices extends Command {
} }
} }
$output->writeln('<info>Check indices of the schedulingobjects table.</info>');
if ($schema->hasTable('schedulingobjects')) {
$table = $schema->getTable('schedulingobjects');
if (!$table->hasIndex('schedulobj_principuri_index')) {
$output->writeln('<info>Adding schedulobj_principuri_index index to the schedulingobjects table, this can take some time...</info>');
$table->addIndex(['principaluri'], 'schedulobj_principuri_index');
$this->connection->migrateToSchema($schema->getWrappedSchema());
$updated = true;
$output->writeln('<info>schedulingobjects table updated successfully.</info>');
}
}
if (!$updated) { if (!$updated) {
$output->writeln('<info>Done.</info>'); $output->writeln('<info>Done.</info>');
} }