From 536a812de48e15aed16fe32bb7308a49f57d05df Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 1 Dec 2021 23:57:40 +0100 Subject: Add an index for selecting the next job Signed-off-by: Joas Schilling --- core/Command/Db/AddMissingIndices.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'core/Command') diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 348b4f94f0d..57fa49149f6 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -326,6 +326,19 @@ class AddMissingIndices extends Command { } } + $output->writeln('Check indices of the oc_jobs table.'); + if ($schema->hasTable('jobs')) { + $table = $schema->getTable('jobs'); + if (!$table->hasIndex('job_lastcheck_reserved')) { + $output->writeln('Adding job_lastcheck_reserved index to the oc_jobs table, this can take some time...'); + + $table->addIndex(['last_checked', 'reserved_at'], 'job_lastcheck_reserved'); + $this->connection->migrateToSchema($schema->getWrappedSchema()); + $updated = true; + $output->writeln('oc_properties table updated successfully.'); + } + } + if (!$updated) { $output->writeln('Done.'); } -- cgit v1.2.3