Merge branch 'fronkdev' into 'master'

Added Poprack table migration

See merge request fronk/thetool!122
This commit is contained in:
Frank Schubert
2023-11-14 14:02:11 +00:00

View File

@@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddPoprackTables extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$poprack = $this->table("Poprack");
$poprack->addColumn("pop_id", "integer", ["null" => false]);
$poprack->addColumn("name", "string", ["null" => false, "limit" => 64]);
$poprack->addColumn("he", "integer", ["null" => false]);
$poprack->addColumn("sort", "integer", ["null" => false, "default" => 99]);
$poprack->addColumn("create_by", "integer", ["null" => false]);
$poprack->addColumn("edit_by", "integer", ["null" => false]);
$poprack->addColumn("create", "integer", ["null" => false]);
$poprack->addColumn("edit", "integer", ["null" => false]);
$poprack->addIndex("name", ["unique" => false]);
$poprack->create();
$prmodule = $this->table("Poprackmodule");
$prmodule->addColumn("poprack_id", "integer", ["null" => false]);
$prmodule->addColumn("type", "integer", ["null" => false, "default" => 0, "comment" => "0:LWL/1:Device"]);
$prmodule->addColumn("device_id", "integer", ["null" => false]);
$prmodule->addColumn("name", "text", ["null" => true]);
$prmodule->addColumn("start_he", "integer", ["null" => false]);
$prmodule->addColumn("end_he", "integer", ["null" => false]);
$prmodule->addColumn("ports", "integer", ["null" => true, "default" => null]);
$prmodule->addColumn("plug", "integer", ["null" => true, "default" => null, "comment" => "1:LC/APC/2:SC/APC/3:E2000/APC"]);
$prmodule->addColumn("width", "integer", ["null" => false, "default" => 12]);
$prmodule->addColumn("position", "integer", ["null" => true, "default" => null]);
$prmodule->addColumn("create_by", "integer", ["null" => false]);
$prmodule->addColumn("edit_by", "integer", ["null" => false]);
$prmodule->addColumn("create", "integer", ["null" => false]);
$prmodule->addColumn("edit", "integer", ["null" => false]);
$prmodule->create();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("Poprackmodule")->drop()->save();
$this->table("Poprack")->drop()->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}