Files
thetool/db/migrations/20240202152709_hausnummer_add_subcd.php
2024-02-05 12:39:40 +01:00

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");
}
}
}