29 lines
1.0 KiB
PHP
29 lines
1.0 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class HausnummerAddIndexes extends AbstractMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
if($this->getEnvironment() == "addressdb") {
|
|
$table = $this->table("Hausnummer");
|
|
$table->addIndex("rimo_type", ["name" => "idx_rimo_type"]);
|
|
$table->addIndex("rimo_op_state", ["name" => "idx_rimo_op_state"]);
|
|
$table->addIndex(["rimo_type", "rimo_op_state"], ["name" => "idx_combined_type_state"]);
|
|
$table->update();
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
if($this->getEnvironment() == "addressdb") {
|
|
$table = $this->table("Hausnummer");
|
|
$table->removeIndex(["rimo_type"], ["name" => "idx_rimo_type"]);
|
|
$table->removeIndex(["rimo_op_state"], ["name" => "idx_rimo_op_state"]);
|
|
$table->removeIndex(["rimo_type", "rimo_op_state"], ["name" => "idx_combined_type_state"]);
|
|
$table->update();
|
|
}
|
|
}
|
|
} |