35 lines
892 B
PHP
35 lines
892 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class HausnummerAddSubcd extends AbstractMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
if($this->getEnvironment() == "thetool") {
|
|
|
|
}
|
|
|
|
if($this->getEnvironment() == "addressdb") {
|
|
$table = $this->table("Hausnummer");
|
|
$table->addColumn("subcd", "integer", ["null" => true, "default" => null, "after" => "adrcd"]);
|
|
$table->addIndex(["adrcd", "subcd"]);
|
|
$table->update();
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
if($this->getEnvironment() == "thetool") {
|
|
|
|
}
|
|
|
|
if($this->getEnvironment() == "addressdb") {
|
|
$table = $this->table("Hausnummer");
|
|
$table->removeIndex(["adrcd", "subcd"]);
|
|
$table("Hausnummer")->removeColumn("subcd");
|
|
}
|
|
}
|
|
}
|