Files
thetool/db/migrations/20241008123850_netzgebiet_add_unitcount_sd_md.php

36 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class NetzgebietAddUnitcountSdMd extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
}
if($this->getEnvironment() == "addressdb") {
$table = $this->table("Netzgebiet");
$table->addColumn("unit_count_sd", "integer", ["null" => false, "default" => 0, "comment" => "single-dwelling", "after" => "unit_count"]);
$table->addColumn("unit_count_md", "integer", ["null" => false, "default" => 0, "comment" => "multi-dwelling", "after" => "unit_count_sd"]);
$table->update();
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
}
if($this->getEnvironment() == "addressdb") {
$this->table("Netzgebiet")
->removeColumn("unit_count_md")
->removeColumn("unit_count_sd")
->update();
}
}
}