change migration

This commit is contained in:
2026-07-23 12:18:56 +02:00
parent b2a79aec1b
commit 7b6d85766d
@@ -8,18 +8,22 @@ final class DropUniqPartAnalysisIndex extends AbstractMigration
{
public function up(): void
{
$this->table('identification_parts_analyses')
->removeIndexByName('uniq_part_analysis')
->update();
$table = $this->table('identification_parts_analyses');
if ($table->hasIndexByName('uniq_part_analysis')) {
$table->removeIndexByName('uniq_part_analysis')->update();
}
}
public function down(): void
{
$this->table('identification_parts_analyses')
->addIndex(['part_id', 'analysis_recordkey'], [
$table = $this->table('identification_parts_analyses');
if (!$table->hasIndexByName('uniq_part_analysis')) {
$table->addIndex(['part_id', 'analysis_recordkey'], [
'unique' => true,
'name' => 'uniq_part_analysis',
])
->update();
])->update();
}
}
}