Files
thetool/db/migrations/20231219144324_poprackmodulepatch.php
2024-12-22 15:58:19 +01:00

44 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class Poprackmodulepatch extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
// on error make poprackmodule.id signed
$poprackmodulepatch = $this->table("Poprackmodulepatch", ['signed' => true]);
$poprackmodulepatch->addColumn("poprackmodule_id", "integer", ["null" => false, "signed" => false])->addIndex("poprackmodule_id");
$poprackmodulepatch->addColumn("port", "integer", ["null" => false])->addIndex(['port']);
$poprackmodulepatch->addColumn("fiberPlanCable_id", "integer", ["null" => true, "default" => null])->addIndex(['fiberPlanCable_id']);
$poprackmodulepatch->addColumn("destination", "integer", ["null" => true, "default" => null, "comment" => "1:startpoint/2:endpoint"]);
$poprackmodulepatch->addColumn("create_by", "integer", ["null" => false]);
$poprackmodulepatch->addColumn("edit_by", "integer", ["null" => false]);
$poprackmodulepatch->addColumn("create", "integer", ["null" => false]);
$poprackmodulepatch->addColumn("edit", "integer", ["null" => false]);
$poprackmodulepatch->save();
$poprackmodulepatch = $this->table("Poprackmodulepatch");
$poprackmodulepatch->addForeignKey('poprackmodule_id', 'Poprackmodule', 'id',['delete'=> 'CASCADE', 'update'=> 'RESTRICT','constraint' => 'poprackmodule_id']);
$poprackmodulepatch->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("Poprackmodulepatch")->drop()->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}