change migration
This commit is contained in:
@@ -8,18 +8,22 @@ final class DropUniqPartAnalysisIndex extends AbstractMigration
|
|||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
$this->table('identification_parts_analyses')
|
$table = $this->table('identification_parts_analyses');
|
||||||
->removeIndexByName('uniq_part_analysis')
|
|
||||||
->update();
|
if ($table->hasIndexByName('uniq_part_analysis')) {
|
||||||
|
$table->removeIndexByName('uniq_part_analysis')->update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
$this->table('identification_parts_analyses')
|
$table = $this->table('identification_parts_analyses');
|
||||||
->addIndex(['part_id', 'analysis_recordkey'], [
|
|
||||||
|
if (!$table->hasIndexByName('uniq_part_analysis')) {
|
||||||
|
$table->addIndex(['part_id', 'analysis_recordkey'], [
|
||||||
'unique' => true,
|
'unique' => true,
|
||||||
'name' => 'uniq_part_analysis',
|
'name' => 'uniq_part_analysis',
|
||||||
])
|
])->update();
|
||||||
->update();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user