58 lines
2.6 KiB
PHP
58 lines
2.6 KiB
PHP
<?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" => true, "default" => null]);
|
|
$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") {
|
|
|
|
}
|
|
}
|
|
}
|