From 1ff6a3f09315c6221b6e63743db0161bb4f6ca46 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Sun, 28 Apr 2024 21:02:56 +0200 Subject: [PATCH] refs #95 safely drop indexes in last migration step Signed-off-by: Julien Veyssier --- lib/Migration/Version020000Date20240325142435.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Migration/Version020000Date20240325142435.php b/lib/Migration/Version020000Date20240325142435.php index d6e3f975..ac3b5067 100644 --- a/lib/Migration/Version020000Date20240325142435.php +++ b/lib/Migration/Version020000Date20240325142435.php @@ -31,21 +31,27 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt if ($schema->hasTable('openai_prompts')) { $table = $schema->getTable('openai_prompts'); - $table->dropIndex('openai_prompt_userid'); + if ($table->hasIndex('openai_prompt_userid')) { + $table->dropIndex('openai_prompt_userid'); + } $schema->dropTable('openai_prompts'); $schemaChanged = true; } if ($schema->hasTable('openai_i_gen')) { $table = $schema->getTable('openai_i_gen'); - $table->dropIndex('openai_i_gen_hash'); + if ($table->hasIndex('openai_i_gen_hash')) { + $table->dropIndex('openai_i_gen_hash'); + } $schema->dropTable('openai_i_gen'); $schemaChanged = true; } if ($schema->hasTable('openai_i_url')) { $table = $schema->getTable('openai_i_url'); - $table->dropIndex('openai_i_url_gen_id'); + if ($table->hasIndex('openai_i_url_gen_id')) { + $table->dropIndex('openai_i_url_gen_id'); + } $schema->dropTable('openai_i_url'); $schemaChanged = true; }