98 lines
5.6 KiB
PHP
98 lines
5.6 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class AddVoicenumberTables extends AbstractMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
if($this->getEnvironment() == "thetool") {
|
|
$table = $this->table("Voicenumberblock");
|
|
$table->addColumn("name", "string", ["null" => true, "limit" => 255, "default" => null]);
|
|
$table->addColumn("countrycode", "integer", ["null" => false]);
|
|
$table->addColumn("areacode", "integer", ["null" => false]);
|
|
$table->addColumn("prefix", "string", ["null" => false, "limit" => 64]);
|
|
$table->addColumn("first", "string", ["null" => false, "limit" => 64]);
|
|
$table->addColumn("last", "string", ["null" => false, "limit" => 64]);
|
|
$table->addColumn("comment", "text", ["null" => true, "default" => null]);
|
|
$table->addColumn("create_by", "integer", ["null" => false]);
|
|
$table->addColumn("edit_by", "integer", ["null" => false]);
|
|
$table->addColumn("create", "integer", ["null" => false]);
|
|
$table->addColumn("edit", "integer", ["null" => false]);
|
|
$table->create();
|
|
|
|
$table = $this->table("Voicenumber");
|
|
$table->addColumn("voicenumberblock_id", "integer", ["null" => true, "default" => null]);
|
|
$table->addColumn("orderproduct_id", "integer", ["null" => true, "default" => null]);
|
|
$table->addColumn("contract_id", "integer", ["null" => true, "default" => null]);
|
|
$table->addColumn("active", "integer", ["null" => false, "default" => 0, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
|
$table->addColumn("activated_date", "integer", ["null" => true, "default" => null]);
|
|
$table->addColumn("routing", "enum", ["values" => "sipit,kolmisoft", "null" => false, "default" => "kolmisoft"]);
|
|
$table->addColumn("number", "string", ["null" => false, "limit" => 64]);
|
|
$table->addColumn("port_in_date", "integer", ["null" => true, "default" => null]);
|
|
$table->addColumn("port_out_date", "integer", ["null" => true, "default" => null]);
|
|
$table->addColumn("ported_in", "integer", ["null" => true, "default" => null]);
|
|
$table->addColumn("ported_out", "integer", ["null" => true, "default" => null]);
|
|
$table->addColumn("ported_from", "string", ["null" => true, "default" => null, "limit" => 64]);
|
|
$table->addColumn("ported_to", "string", ["null" => true, "default" => null, "limit" => 64]);
|
|
$table->addColumn("disabled", "integer", ["null" => false, "default" => 0, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
|
$table->addColumn("disabled_reason", "enum", ["values" => "ported_out,ported_back,reserved,legacy,damaged", "null" => true, "default" => null]);
|
|
$table->addColumn("enable_on_date", "integer", ["null" => true, "default" => null]);
|
|
$table->addColumn("comment", "text", ["null" => true, "default" => null]);
|
|
$table->addColumn("create_by", "integer", ["null" => false]);
|
|
$table->addColumn("edit_by", "integer", ["null" => false]);
|
|
$table->addColumn("create", "integer", ["null" => false]);
|
|
$table->addColumn("edit", "integer", ["null" => false]);
|
|
$table->create();
|
|
|
|
$table = $this->table("Voiceplan");
|
|
$table->addColumn("name", "string", ["null" => false, "limit" => 64]);
|
|
$table->addColumn("description", "text", ["null" => true, "default" => null]);
|
|
$table->addColumn("source", "string", ["null" => true, "default" => null, "limit" => 255]);
|
|
$table->addColumn("source_id", "string", ["null" => true, "default" => null, "limit" => 255]);
|
|
$table->addColumn("increment_first", "integer", ["null" => false, "default" => 1]);
|
|
$table->addColumn("increment", "integer", ["null" => false, "default" => 1]);
|
|
$table->addColumn("create_by", "integer", ["null" => false]);
|
|
$table->addColumn("edit_by", "integer", ["null" => false]);
|
|
$table->addColumn("create", "integer", ["null" => false]);
|
|
$table->addColumn("edit", "integer", ["null" => false]);
|
|
$table->create();
|
|
|
|
$table = $this->table("Voiceplandestination");
|
|
$table->addColumn("voiceplan_id", "integer", ["null" => false]);
|
|
$table->addColumn("destination", "string", ["null" => false, "limit" => 64]);
|
|
$table->addColumn("prefix", "string", ["null" => false, "limit" => 64]);
|
|
$table->addColumn("purchase_price", "decimal", ["null" => false, "precision" => 14, "scale" => 4]);
|
|
$table->addColumn("price", "decimal", ["null" => false, "precision" => 14, "scale" => 4]);
|
|
$table->addColumn("increment_first", "integer", ["null" => false, "default" => 1]);
|
|
$table->addColumn("increment", "integer", ["null" => false, "default" => 1]);
|
|
$table->addColumn("create_by", "integer", ["null" => false]);
|
|
$table->addColumn("edit_by", "integer", ["null" => false]);
|
|
$table->addColumn("create", "integer", ["null" => false]);
|
|
$table->addColumn("edit", "integer", ["null" => false]);
|
|
$table->create();
|
|
|
|
|
|
}
|
|
|
|
if($this->getEnvironment() == "addressdb") {
|
|
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
if($this->getEnvironment() == "thetool") {
|
|
$this->table("Voiceplandestination")->drop()->save();
|
|
$this->table("Voiceplan")->drop()->save();
|
|
$this->table("Voicenumber")->drop()->save();
|
|
$this->table("Voicenumberblock")->drop()->save();
|
|
}
|
|
|
|
if($this->getEnvironment() == "addressdb") {
|
|
|
|
}
|
|
}
|
|
}
|