30 lines
746 B
PHP
30 lines
746 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class DropUniqPartAnalysisIndex extends AbstractMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
$table = $this->table('identification_parts_analyses');
|
|
|
|
if ($table->hasIndexByName('uniq_part_analysis')) {
|
|
$table->removeIndexByName('uniq_part_analysis')->update();
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
$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();
|
|
}
|
|
}
|
|
}
|