added new tool type field

This commit is contained in:
Luca Haid
2025-05-27 14:04:36 +02:00
parent 5a8fef9611
commit ece7dcf806
9 changed files with 207 additions and 14 deletions
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AdbHausnummerAddToolType extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "addressdb") {
$Hausnummer = $this->table("Hausnummer");
$Hausnummer->addColumn("tool_building_type", "integer", ["default" => 0, "null" => false])
->addColumn("tool_building_type_override", "boolean", ["default" => 0, "null" => false]);
$Hausnummer->update();
}
}
public function down(): void
{
if($this->getEnvironment() == "addressdb") {
$Hausnummer = $this->table("Hausnummer");
if($Hausnummer->hasColumn("tool_building_type")) $Hausnummer->removeColumn("tool_building_type");
if($Hausnummer->hasColumn("tool_building_type_override")) $Hausnummer->removeColumn("tool_building_type_override");
$Hausnummer->update();
}
}
}