63 lines
3.2 KiB
PHP
63 lines
3.2 KiB
PHP
<?php /** @noinspection ALL */
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class UpdateWarehouseTables extends AbstractMigration {
|
|
public function up(): void {
|
|
if ($this->getEnvironment() == "thetool") {
|
|
$WarehouseArticle = $this->table("WarehouseArticle");
|
|
$WarehouseArticle->changeColumn("cheapestSellPrice", "text", ["null" => false]);
|
|
$WarehouseArticle->addColumn("defaultSellMultiplier", "float", ["null" => false, "default" => 1]);
|
|
$WarehouseArticle->addColumn("unit", "string", ["null" => false]);
|
|
$WarehouseArticle->addColumn("isSerialDocumentation", "integer", ["null" => false]);
|
|
$WarehouseArticle->addColumn("revenueAccount", "integer", ["null" => false]);
|
|
$WarehouseArticle->update();
|
|
|
|
$WarehouseArticlePacket = $this->table("WarehouseArticlePacket", ["signed" => true]);
|
|
$WarehouseArticlePacket->addColumn("title", "string", ["null" => false]);
|
|
$WarehouseArticlePacket->addColumn("description", "text", ["null" => false]);
|
|
$WarehouseArticlePacket->addColumn("category", "string", ["null" => false]);
|
|
$WarehouseArticlePacket->addColumn("overrideSellPrice", "float", ["null" => true]);
|
|
$WarehouseArticlePacket->addColumn("calculatedSellPrice", "float", ["null" => true]);
|
|
$WarehouseArticlePacket->addColumn("subItems", "text", ["null" => false]);
|
|
$WarehouseArticlePacket->create();
|
|
|
|
$WarehouseEShopOrderItem = $this->table("WarehouseEShopOrderItem");
|
|
$WarehouseEShopOrderItem->changeColumn("articleId", "integer", ["null" => true]);
|
|
$WarehouseEShopOrderItem->addColumn("articlePacketId", "integer", ["null" => true]);
|
|
$WarehouseEShopOrderItem->update();
|
|
|
|
$WarehouseRevenueAccount = $this->table("WarehouseRevenueAccount", ["signed" => true]);
|
|
$WarehouseRevenueAccount->addColumn("revenueAccountNumber", "integer", ["null" => false]);
|
|
$WarehouseRevenueAccount->addColumn("title", "string", ["null" => false]);
|
|
$WarehouseRevenueAccount->create();
|
|
|
|
}
|
|
}
|
|
|
|
public function down(): void {
|
|
if ($this->getEnvironment() == "thetool") {
|
|
$WarehouseArticle = $this->table("WarehouseArticle");
|
|
$WarehouseArticle->changeColumn("cheapestSellPrice", "float", ["null" => false]);
|
|
$WarehouseArticle->removeColumn("defaultSellMultiplier");
|
|
$WarehouseArticle->removeColumn("unit");
|
|
$WarehouseArticle->removeColumn("isSerialDocumentation");
|
|
$WarehouseArticle->removeColumn("revenueAccount");
|
|
$WarehouseArticle->update();
|
|
|
|
$WarehouseArticlePacket = $this->table("WarehouseArticlePacket");
|
|
$WarehouseArticlePacket->drop()->save();
|
|
|
|
$WarehouseEShopOrderItem = $this->table("WarehouseEShopOrderItem");
|
|
$WarehouseEShopOrderItem->changeColumn("articleId", "integer", ["null" => false]);
|
|
$WarehouseEShopOrderItem->removeColumn("articlePacketId");
|
|
$WarehouseEShopOrderItem->update();
|
|
|
|
$WarehouseRevenueAccount = $this->table("WarehouseRevenueAccount");
|
|
$WarehouseRevenueAccount->drop()->save();
|
|
|
|
}
|
|
}
|
|
}
|