Files
thetool/db/migrations/20250331090000_warehouse_modify_16.php

72 lines
4.0 KiB
PHP

<?php declare(strict_types = 1);
use Phinx\Migration\AbstractMigration;
final class WarehouseModify16 extends AbstractMigration {
public function up(): void {
if ($this->getEnvironment() == "thetool") {
$WarehouseArticleTable = $this->table("WarehouseArticle");
$WarehouseArticleTable
->changeColumn("isEShop", "integer", ["default" => 0])
->changeColumn("isEShopHide", "integer", ["default" => 0])
->changeColumn("isSerialDocumentation", "integer", ["default" => 0])
->save();
$WarehouseOfferTable = $this->table("WarehouseOffer", ["id" => false, "primary_key" => "id"]);
$WarehouseOfferTable
->addColumn("id", "integer", ["identity" => true])
->addColumn("offerNumber", "string", ["limit" => 255, "null" => false])
->addColumn("reference", "string", ["limit" => 255, "null" => false])
->addColumn("customerNumber", "string", ["limit" => 255, "null" => false])
->addColumn("customerName", "string", ["limit" => 255, "null" => false])
->addColumn("customerStreet", "string", ["limit" => 255, "null" => false])
->addColumn("customerCity", "string", ["limit" => 255, "null" => false])
->addColumn("customerZip", "string", ["limit" => 255, "null" => false])
->addColumn("customerVAT", "string", ["limit" => 255, "null" => false])
->addColumn("editor", "integer", ["null" => false])
->addColumn("purpose", "string", ["limit" => 255, "null" => false])
->addColumn("positions", "text", ["null" => false])
->addColumn("alternativePositions", "text", ["null" => false])
->addColumn("totalDiscount", "float", ["null" => false])
->addColumn("paymentTerms", "string", ["limit" => 255, "null" => false])
->addColumn("deliveryTerms", "string", ["limit" => 255, "null" => false])
->addColumn("closingText", "text", ["null" => false])
->addColumn("notes", "string", ["limit" => 255, "null" => false])
->addColumn("status", "string", ["limit" => 255, "null" => false])
->addColumn("totalAmount", "float", ["null" => false])
->addColumn("create", "integer", ["null" => false])
->addColumn("createBy", "integer", ["null" => false])
->save();
$WarehouseOfferTemplateTable = $this->table("WarehouseOfferTemplate", ["id" => false, "primary_key" => "id"]);
$WarehouseOfferTemplateTable
->addColumn("id", "integer", ["identity" => true])
->addColumn("templateName", "string", ["limit" => 255, "null" => false])
->addColumn("positions", "text", ["null" => false])
->addColumn("totalDiscount", "float", ["null" => false])
->addColumn("paymentTerms", "string", ["limit" => 255, "null" => false])
->addColumn("deliveryTerms", "string", ["limit" => 255, "null" => false])
->addColumn("closingText", "text", ["null" => false])
->addColumn("notes", "text", ["null" => false])
->save();
}
}
public function down(): void {
if ($this->getEnvironment() == "thetool") {
// change table "WarehouseArticle" and set isEShop, isEShopHide, isSerialDocumentation to no default
$WarehouseArticleTable = $this->table("WarehouseArticle");
$WarehouseArticleTable
->changeColumn("isEShop", "integer", ["default" => null])
->changeColumn("isEShopHide", "integer", ["default" => null])
->changeColumn("isSerialDocumentation", "integer", ["default" => null])
->save();
$this->table("WarehouseOffer")->drop()->save();
$this->table("WarehouseOfferTemplate")->drop()->save();
}
}
}