From 415294e34591b48c598bf38da33a5ad7b40acf7c Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Mon, 7 Feb 2022 09:25:27 +0100 Subject: Add index for direct editing cleanup job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/Application.php | 7 +++++++ core/Command/Db/AddMissingIndices.php | 13 +++++++++++++ core/Migrations/Version18000Date20191014105105.php | 1 + 3 files changed, 21 insertions(+) (limited to 'core') diff --git a/core/Application.php b/core/Application.php index 0f363f8c699..545588ab208 100644 --- a/core/Application.php +++ b/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'); + } + } } ); diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 4c86a8705db..489e44f4011 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -352,6 +352,19 @@ class AddMissingIndices extends Command { } } + $output->writeln('Check indices of the oc_direct_edit table.'); + if ($schema->hasTable('direct_edit')) { + $table = $schema->getTable('direct_edit'); + if (!$table->hasIndex('direct_edit_timestamp')) { + $output->writeln('Adding direct_edit_timestamp index to the oc_direct_edit table, this can take some time...'); + + $table->addIndex(['timestamp'], 'direct_edit_timestamp'); + $this->connection->migrateToSchema($schema->getWrappedSchema()); + $updated = true; + $output->writeln('oc_direct_edit table updated successfully.'); + } + } + if (!$updated) { $output->writeln('Done.'); } diff --git a/core/Migrations/Version18000Date20191014105105.php b/core/Migrations/Version18000Date20191014105105.php index fa7eed899ae..740a03ba5d1 100644 --- a/core/Migrations/Version18000Date20191014105105.php +++ b/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; } -- cgit v1.2.3