mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
Add an index for selecting the next job
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
44ecd0d1d5
commit
536a812de4
3 changed files with 21 additions and 0 deletions
|
|
@ -196,6 +196,13 @@ class Application extends App {
|
|||
$subject->addHintForMissingSubject($table->getName(), 'properties_path_index');
|
||||
}
|
||||
}
|
||||
|
||||
if ($schema->hasTable('jobs')) {
|
||||
$table = $schema->getTable('jobs');
|
||||
if (!$table->hasIndex('job_lastcheck_reserved')) {
|
||||
$subject->addHintForMissingSubject($table->getName(), 'job_lastcheck_reserved');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -326,6 +326,19 @@ class AddMissingIndices extends Command {
|
|||
}
|
||||
}
|
||||
|
||||
$output->writeln('<info>Check indices of the oc_jobs table.</info>');
|
||||
if ($schema->hasTable('jobs')) {
|
||||
$table = $schema->getTable('jobs');
|
||||
if (!$table->hasIndex('job_lastcheck_reserved')) {
|
||||
$output->writeln('<info>Adding job_lastcheck_reserved index to the oc_jobs table, this can take some time...</info>');
|
||||
|
||||
$table->addIndex(['last_checked', 'reserved_at'], 'job_lastcheck_reserved');
|
||||
$this->connection->migrateToSchema($schema->getWrappedSchema());
|
||||
$updated = true;
|
||||
$output->writeln('<info>oc_properties table updated successfully.</info>');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$updated) {
|
||||
$output->writeln('<info>Done.</info>');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -525,6 +525,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
|
|||
]);
|
||||
$table->setPrimaryKey(['id']);
|
||||
$table->addIndex(['class'], 'job_class_index');
|
||||
$table->addIndex(['last_checked', 'reserved_at'], 'job_lastcheck_reserved');
|
||||
}
|
||||
|
||||
if (!$schema->hasTable('users')) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue