53 lines
1.7 KiB
PHP
53 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class CpeprovAddNewIndexes extends AbstractMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
if ($this->getEnvironment() == 'thetool') {
|
|
$orderProduct = $this->table('OrderProduct');
|
|
$orderProduct->addIndex('product_id', ['name' => 'idx_product_id'])
|
|
->addIndex('termination_id', ['name' => 'idx_termination_id'])
|
|
->save();
|
|
|
|
$product = $this->table('Product');
|
|
$product->addIndex('producttech_id', ['name' => 'idx_producttech_id'])
|
|
->save();
|
|
|
|
$productAttribute = $this->table('ProductAttribute');
|
|
$productAttribute->addIndex('producttechattribute_id', ['name' => 'idx_producttechattribute_id'])
|
|
->save();
|
|
|
|
$termination = $this->table('Termination');
|
|
$termination->addIndex('status_id', ['name' => 'idx_status_id'])
|
|
->save();
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
if ($this->getEnvironment() == 'thetool') {
|
|
$orderProduct = $this->table('OrderProduct');
|
|
$orderProduct->removeIndexByName('idx_product_id')
|
|
->removeIndexByName('idx_termination_id')
|
|
->save();
|
|
|
|
$product = $this->table('Product');
|
|
$product->removeIndexByName('idx_producttech_id')
|
|
->save();
|
|
|
|
$productAttribute = $this->table('ProductAttribute');
|
|
$productAttribute->removeIndexByName('idx_producttechattribute_id')
|
|
->save();
|
|
|
|
$termination = $this->table('Termination');
|
|
$termination->removeIndexByName('idx_status_id')
|
|
->save();
|
|
}
|
|
}
|
|
}
|