Files
thetool/db/migrations/20240416123342_device_add_field_parent_id.php
2024-04-16 15:14:36 +02:00

32 lines
781 B
PHP

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class DeviceAddFieldParentId extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("Device", ["signed" => true]);
$table->addColumn("parent_id", "integer", ["null" => true, "after" => "devicetype_id"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("Device")->removeColumn("parent_id")->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}