Browse Source

Add index for direct editing cleanup job

Signed-off-by: Julius Härtl <jus@bitgrid.net>
pull/31042/head
Julius Härtl 4 years ago
parent
commit
415294e345
No known key found for this signature in database GPG Key ID: 4C614C6ED2CDE6DF
  1. 7
      core/Application.php
  2. 13
      core/Command/Db/AddMissingIndices.php
  3. 1
      core/Migrations/Version18000Date20191014105105.php

7
core/Application.php

@ -206,6 +206,13 @@ class Application extends App {
$subject->addHintForMissingSubject($table->getName(), 'job_lastcheck_reserved');
}
}
if ($schema->hasTable('direct_edit')) {
$table = $schema->getTable('direct_edit');
if (!$table->hasIndex('direct_edit_timestamp')) {
$subject->addHintForMissingSubject($table->getName(), 'direct_edit_timestamp');
}
}
}
);

13
core/Command/Db/AddMissingIndices.php

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

1
core/Migrations/Version18000Date20191014105105.php

@ -89,6 +89,7 @@ class Version18000Date20191014105105 extends SimpleMigrationStep {
$table->setPrimaryKey(['id']);
$table->addIndex(['token']);
$table->addIndex(['timestamp'], 'direct_edit_timestamp');
return $schema;
}

Loading…
Cancel
Save