Skip to content

Commit

Permalink
Merge pull request #30185 from nextcloud/backport/30032/stable22
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Dec 10, 2021
2 parents b880b95 + 0cd2f88 commit 7936aec
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ function (GenericEvent $event) use ($container) {
$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');
}
}
}
);

Expand Down
13 changes: 13 additions & 0 deletions core/Command/Db/AddMissingIndices.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,19 @@ private function addCoreIndexes(OutputInterface $output) {
}
}

$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>');
}
Expand Down
1 change: 1 addition & 0 deletions core/Migrations/Version13000Date20170718121200.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['class'], 'job_class_index');
$table->addIndex(['last_checked', 'reserved_at'], 'job_lastcheck_reserved');
}

if (!$schema->hasTable('users')) {
Expand Down

0 comments on commit 7936aec

Please sign in to comment.