From 732c4475d8f9d1e1d32ccfc7c34f4cab057fc79b Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 29 Oct 2024 13:40:42 +0100 Subject: [PATCH 1/2] perf: Add index for group_folders table Signed-off-by: provokateurin --- .../Version19000Date20241029123147.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lib/Migration/Version19000Date20241029123147.php diff --git a/lib/Migration/Version19000Date20241029123147.php b/lib/Migration/Version19000Date20241029123147.php new file mode 100644 index 000000000..f53beaa88 --- /dev/null +++ b/lib/Migration/Version19000Date20241029123147.php @@ -0,0 +1,37 @@ +hasTable('group_folders')) { + $table = $schema->getTable('group_folders'); + if (!$table->hasIndex('gf_folders_folder_id')) { + $table->addUniqueIndex(['folder_id'], 'gf_folders_folder_id'); + } + } + + return $schema; + } +} From 63df9b618a1a16bef4e3e3cdedfde210e8106c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 9 Jan 2025 15:06:07 +0100 Subject: [PATCH 2/2] fix: Only return $schema if there was changes in migration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet [skip ci] --- lib/Migration/Version19000Date20241029123147.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Migration/Version19000Date20241029123147.php b/lib/Migration/Version19000Date20241029123147.php index f53beaa88..00348cea0 100644 --- a/lib/Migration/Version19000Date20241029123147.php +++ b/lib/Migration/Version19000Date20241029123147.php @@ -16,10 +16,7 @@ class Version19000Date20241029123147 extends SimpleMigrationStep { /** - * @param IOutput $output * @param Closure(): ISchemaWrapper $schemaClosure - * @param array $options - * @return null|ISchemaWrapper */ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ @@ -29,9 +26,10 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $table = $schema->getTable('group_folders'); if (!$table->hasIndex('gf_folders_folder_id')) { $table->addUniqueIndex(['folder_id'], 'gf_folders_folder_id'); + return $schema; } } - return $schema; + return null; } }