getEnvironment() == "thetool") { // WarehouseArticle Table $warehouseArticleTable = $this->table("WarehouseArticle", ["signed" => true]); $warehouseArticleTable->addColumn("title", "string", ["null" => false, "limit" => 255]); $warehouseArticleTable->addColumn("description", "text", ["null" => false]); $warehouseArticleTable->addColumn("category", "string", ["null" => false, "limit" => 255]); $warehouseArticleTable->addColumn("cheapestPurchasePrice", "float", ["null" => true]); $warehouseArticleTable->addColumn("cheapestSellPrice", "float", ["null" => true]); $warehouseArticleTable->addColumn("warningAmount", "integer", ["null" => false]); $warehouseArticleTable->addColumn("criticalAmount", "integer", ["null" => false]); $warehouseArticleTable->addColumn("isEShop", "integer", ["null" => false, "limit" => \Phinx\Db\Adapter\MysqlAdapter::INT_TINY]); $warehouseArticleTable->addIndex(["category"]); $warehouseArticleTable->addIndex(["isEShop"]); $warehouseArticleTable->save(); // WarehouseArticle Table End // WarehouseArticleDistributor Table $warehouseArticleDistributorTable = $this->table("WarehouseArticleDistributor", ["signed" => true]); $warehouseArticleDistributorTable->addColumn("articleId", "integer", ["null" => false]); $warehouseArticleDistributorTable->addColumn("distributorId", "integer", ["null" => false]); $warehouseArticleDistributorTable->addColumn("purchasePrice", "float", ["null" => false]); $warehouseArticleDistributorTable->addColumn("externalArticleNumber", "string", ["null" => false, "limit" => 255]); $warehouseArticleDistributorTable->addColumn("note", "string", ["null" => true, "limit" => 255]); $warehouseArticleDistributorTable->addIndex(["articleId"]); $warehouseArticleDistributorTable->addIndex(["distributorId"]); $warehouseArticleDistributorTable->save(); // WarehouseArticleDistributor Table End // WarehouseArticlePrice Table $warehouseArticlePriceTable = $this->table("WarehouseArticlePrice", ["signed" => true]); $warehouseArticlePriceTable->addColumn("articleId", "integer", ["null" => false]); $warehouseArticlePriceTable->addColumn("articlePriceTypeId", "integer", ["null" => false]); $warehouseArticlePriceTable->addColumn("priceMultiplier", "float", ["null" => true]); $warehouseArticlePriceTable->addColumn("priceOverride", "float", ["null" => true]); $warehouseArticlePriceTable->addIndex(["articleId"]); $warehouseArticlePriceTable->addIndex(["articlePriceTypeId"]); $warehouseArticlePriceTable->save(); // WarehouseArticlePrice Table End // WarehouseArticlePriceType Table $warehouseArticlePriceTypeTable = $this->table("WarehouseArticlePriceType", ["signed" => true]); $warehouseArticlePriceTypeTable->addColumn("title", "string", ["null" => false, "limit" => 255]); $warehouseArticlePriceTypeTable->save(); // WarehouseArticlePriceType Table End // WarehouseDistributor Table $warehouseDistributorTable = $this->table("WarehouseDistributor", ["signed" => true]); $warehouseDistributorTable->addColumn("name", "string", ["null" => false, "limit" => 255]); $warehouseDistributorTable->addColumn("address", "string", ["null" => false, "limit" => 255]); $warehouseDistributorTable->addColumn("plz", "string", ["null" => false, "limit" => 16]); $warehouseDistributorTable->addColumn("city", "string", ["null" => false, "limit" => 255]); $warehouseDistributorTable->addColumn("countryId", "integer", ["null" => false]); $warehouseDistributorTable->addColumn("email", "string", ["null" => false, "limit" => 255]); $warehouseDistributorTable->addColumn("phone", "string", ["null" => false, "limit" => 255]); $warehouseDistributorTable->addColumn("contactPerson", "string", ["null" => false, "limit" => 255]); $warehouseDistributorTable->save(); // WarehouseDistributor Table End // WarehouseEShopOrder Table $warehouseEShopOrderTable = $this->table("WarehouseEShopOrder", ["signed" => true]); $warehouseEShopOrderTable->addColumn("status", "enum", ["values" => ["new", "accepted", "sent", "done"], "null" => false]); $warehouseEShopOrderTable->addColumn("deliveryMode", "enum", ["values" => ["singleAddress", "multipleAddresses"], "null" => false]); $warehouseEShopOrderTable->addColumn("deliveryAddressName", "string", ["null" => false, "limit" => 255]); $warehouseEShopOrderTable->addColumn("deliveryAddressLine", "string", ["null" => false, "limit" => 255]); $warehouseEShopOrderTable->addColumn("deliveryAddressPLZ", "string", ["null" => false, "limit" => 255]); $warehouseEShopOrderTable->addColumn("deliveryAddressCity", "string", ["null" => false, "limit" => 255]); $warehouseEShopOrderTable->addColumn("create", "integer", ["null" => false]); $warehouseEShopOrderTable->addColumn("createBy", "integer", ["null" => false]); $warehouseEShopOrderTable->save(); // WarehouseEShopOrder Table End // WarehouseEShopOrderItem Table $warehouseEShopOrderItemTable = $this->table("WarehouseEShopOrderItem", ["signed" => true]); $warehouseEShopOrderItemTable->addColumn("orderId", "integer", ["null" => false]); $warehouseEShopOrderItemTable->addColumn("articleId", "integer", ["null" => false]); $warehouseEShopOrderItemTable->addColumn("quantity", "integer", ["null" => false]); $warehouseEShopOrderItemTable->addIndex(["orderId"]); $warehouseEShopOrderItemTable->save(); // WarehouseEShopOrderItem Table End // WarehouseHistory Table $warehouseHistoryTable = $this->table("WarehouseHistory", ["signed" => true]); $warehouseHistoryTable->addColumn("table", "string", ["null" => false, "limit" => 255]); $warehouseHistoryTable->addColumn("row_id", "integer", ["null" => false]); $warehouseHistoryTable->addColumn("key", "string", ["null" => false, "limit" => 255]); $warehouseHistoryTable->addColumn("old_value", "string", ["null" => true, "limit" => 255]); $warehouseHistoryTable->addColumn("new_value", "string", ["null" => true, "limit" => 255]); $warehouseHistoryTable->addColumn("note", "string", ["null" => true, "limit" => 255]); $warehouseHistoryTable->addColumn("user_id", "integer", ["null" => false]); $warehouseHistoryTable->addColumn("create", "integer", ["null" => false]); $warehouseHistoryTable->addIndex(["table"]); $warehouseHistoryTable->addIndex(["row_id"]); $warehouseHistoryTable->save(); // WarehouseHistory Table End // WarehouseItem Table $warehouseItemTable = $this->table("WarehouseItem", ["signed" => true]); $warehouseItemTable->addColumn("articleId", "integer", ["null" => false]); $warehouseItemTable->addColumn("warehouseLocationId", "integer", ["null" => false]); $warehouseItemTable->addColumn("quantity", "integer", ["null" => false]); $warehouseItemTable->addColumn("serialNumber", "string", ["null" => true, "limit" => 255]); $warehouseItemTable->addColumn("note", "string", ["null" => true, "limit" => 255]); $warehouseItemTable->addIndex(["articleId"]); $warehouseItemTable->addIndex(["warehouseLocationId"]); $warehouseItemTable->save(); // WarehouseItem Table End // WarehouseLocation Table $warehouseLocationTable = $this->table("WarehouseLocation", ["signed" => true]); $warehouseLocationTable->addColumn("title", "string", ["null" => false, "limit" => 255]); $warehouseLocationTable->addColumn("assignedTo", "integer", ["null" => false]); $warehouseLocationTable->addIndex(["assignedTo"]); $warehouseLocationTable->save(); // WarehouseLocation Table End // WarehouseLocationThresholdOverride Table $warehouseLocationThresholdOverrideTable = $this->table("WarehouseLocationThresholdOverride", ["signed" => true]); $warehouseLocationThresholdOverrideTable->addColumn("locationId", "integer", ["null" => false]); $warehouseLocationThresholdOverrideTable->addColumn("articleId", "integer", ["null" => false]); $warehouseLocationThresholdOverrideTable->addColumn("warningAmount", "integer", ["null" => false]); $warehouseLocationThresholdOverrideTable->addColumn("criticalAmount", "integer", ["null" => false]); $warehouseLocationThresholdOverrideTable->addIndex(["locationId"]); $warehouseLocationThresholdOverrideTable->addIndex(["articleId"]); $warehouseLocationThresholdOverrideTable->save(); // WarehouseLocationThresholdOverride Table End } } public function down(): void { if ($this->getEnvironment() == "thetool") { $this->table("WarehouseArticle")->drop()->save(); $this->table("WarehouseArticleDistributor")->drop()->save(); $this->table("WarehouseArticlePrice")->drop()->save(); $this->table("WarehouseArticlePriceType")->drop()->save(); $this->table("WarehouseDistributor")->drop()->save(); $this->table("WarehouseEShopOrder")->drop()->save(); $this->table("WarehouseEShopOrderItem")->drop()->save(); $this->table("WarehouseHistory")->drop()->save(); $this->table("WarehouseItem")->drop()->save(); $this->table("WarehouseLocation")->drop()->save(); $this->table("WarehouseLocationThresholdOverride")->drop()->save(); } } }