80 lines
5.3 KiB
PHP
80 lines
5.3 KiB
PHP
<?php /** @noinspection ALL */
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class AddHistoricTicket extends AbstractMigration {
|
|
public function up(): void {
|
|
if ($this->getEnvironment() == "thetool") {
|
|
//HistoricTicket Table
|
|
$historicTicket = $this->table("HistoricTicket", ["signed" => true]);
|
|
|
|
$historicTicket->addColumn("ticket_number", "integer", ["null" => true]);
|
|
$historicTicket->addColumn("ticket_verifier", "string", ["null" => false, "default" => "0", "limit" => 255]);
|
|
$historicTicket->addColumn("priority", "integer", ["null" => false, "default" => "1"]);
|
|
$historicTicket->addColumn("status_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("status", "string", ["null" => true, "limit" => 255]);
|
|
$historicTicket->addColumn("type_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("type", "string", ["null" => true, "limit" => 255]);
|
|
$historicTicket->addColumn("user_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("agent_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("contact_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("company", "string", ["null" => false, "limit" => 255]);
|
|
$historicTicket->addColumn("company_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("first_name", "string", ["null" => false, "limit" => 255]);
|
|
$historicTicket->addColumn("middle_name", "string", ["null" => false, "limit" => 255]);
|
|
$historicTicket->addColumn("last_name", "string", ["null" => false, "limit" => 255]);
|
|
$historicTicket->addColumn("email", "string", ["null" => false, "limit" => 255]);
|
|
$historicTicket->addColumn("phone", "string", ["null" => false, "limit" => 255]);
|
|
$historicTicket->addColumn("subject", "string", ["null" => false, "limit" => 255]);
|
|
$historicTicket->addColumn("ctime", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("mtime", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("muser_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("files_folder_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("unseen", "integer", ["null" => false, "default" => "1"]);
|
|
$historicTicket->addColumn("group_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("order_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("last_response_time", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicket->addColumn("cc_addresses", "string", ["null" => false, "limit" => 255]);
|
|
$historicTicket->save();
|
|
|
|
//HistoricTicketMessage Table
|
|
$historicTicketMessage = $this->table("HistoricTicketMessage", ["signed" => true]);
|
|
|
|
$historicTicketMessage->addColumn("ticket_id", "integer", ["null" => false]);
|
|
$historicTicketMessage->addColumn("status_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicketMessage->addColumn("type_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicketMessage->addColumn("has_status", "integer", ["null" => false, "default" => "0", "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
|
$historicTicketMessage->addColumn("has_type", "integer", ["null" => false, "default" => "0", "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
|
$historicTicketMessage->addColumn("content", "text", ["null" => true]);
|
|
$historicTicketMessage->addColumn("attachments", "string", ["null" => false, "limit" => 255]);
|
|
$historicTicketMessage->addColumn("is_note", "integer", ["null" => false, "default" => "0", "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]);
|
|
$historicTicketMessage->addColumn("user_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicketMessage->addColumn("ctime", "integer", ["null" => false]);
|
|
$historicTicketMessage->addColumn("mtime", "integer", ["null" => false]);
|
|
$historicTicketMessage->addColumn("rate_id", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicketMessage->addColumn("rate_amount", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicketMessage->addColumn("rate_hours", "integer", ["null" => false, "default" => "0"]);
|
|
$historicTicketMessage->addColumn("rate_name", "string", ["null" => false, "limit" => 255]);
|
|
$historicTicketMessage->addColumn("rate_cost_code", "string", ["null" => true, "limit" => 255]);
|
|
$historicTicketMessage->save();
|
|
|
|
}
|
|
|
|
if ($this->getEnvironment() == "addressdb") {
|
|
|
|
}
|
|
}
|
|
|
|
public function down(): void {
|
|
if ($this->getEnvironment() == "thetool") {
|
|
$this->table("HistoricTicket")->drop()->save();
|
|
$this->table("HistoricTicketMessage")->drop()->save();
|
|
}
|
|
|
|
if ($this->getEnvironment() == "addressdb") {
|
|
|
|
}
|
|
}
|
|
}
|