46 lines
1.8 KiB
PHP
46 lines
1.8 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class WohneinheitAddPatchdata extends AbstractMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
if($this->getEnvironment() == "thetool") {
|
|
$table = $this->table("Preorder");
|
|
$table->removeColumn("equipment_name");
|
|
$table->removeColumn("equipment_port");
|
|
$table->save();
|
|
}
|
|
|
|
if($this->getEnvironment() == "addressdb") {
|
|
$table = $this->table("Wohneinheit");
|
|
$table->addColumn("patch_cluster", "string", ["null" => true, "default" => null, "limit" => 255, "after" => "nutzung"]);
|
|
$table->addColumn("patch_shelf", "string", ["null" => true, "default" => null, "limit" => 255, "after" => "patch_cluster"]);
|
|
$table->addColumn("patch_module", "string", ["null" => true, "default" => null, "limit" => 255, "after" => "patch_shelf"]);
|
|
$table->addColumn("patch_port", "string", ["null" => true, "default" => null, "limit" => 255, "after" => "patch_module"]);
|
|
$table->update();
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
if($this->getEnvironment() == "thetool") {
|
|
$table = $this->table("Preorder");
|
|
$table->addColumn("equipment_name", "string", ["null" => true, "default" => null, "limit" => 1024, "after" => "technology"]);
|
|
$table->addColumn("equipment_port", "string", ["null" => true, "default" => null, "limit" => 1024, "after" => "equipment_name"]);
|
|
$table->update();
|
|
}
|
|
|
|
if($this->getEnvironment() == "addressdb") {
|
|
$table = $this->table("Wohneinheit");
|
|
$table->removeColumn("patch_port");
|
|
$table->removeColumn("patch_module");
|
|
$table->removeColumn("patch_shelf");
|
|
$table->removeColumn("patch_cluster");
|
|
$table->save();
|
|
}
|
|
}
|
|
}
|