From 68cf47e947b06eb22a22c460e0febc796e5609e2 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 7 Oct 2019 14:39:27 +0200 Subject: [PATCH] Check and add index on principaluri for schedulingobjects table Signed-off-by: Thomas Citharel --- core/Application.php | 7 +++++++ core/Command/Db/AddMissingIndices.php | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/core/Application.php b/core/Application.php index 659a2c5d3d..cc4d9ba990 100644 --- a/core/Application.php +++ b/core/Application.php @@ -153,6 +153,13 @@ class Application extends App { $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'); + } + } } ); diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 02c8999210..527a2cd7b1 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -234,6 +234,19 @@ class AddMissingIndices extends Command { } } + $output->writeln('Check indices of the schedulingobjects table.'); + if ($schema->hasTable('schedulingobjects')) { + $table = $schema->getTable('schedulingobjects'); + if (!$table->hasIndex('schedulobj_principuri_index')) { + $output->writeln('Adding schedulobj_principuri_index index to the schedulingobjects table, this can take some time...'); + + $table->addIndex(['principaluri'], 'schedulobj_principuri_index'); + $this->connection->migrateToSchema($schema->getWrappedSchema()); + $updated = true; + $output->writeln('schedulingobjects table updated successfully.'); + } + } + if (!$updated) { $output->writeln('Done.'); }