WIP PreorderBilling 2025-03-22
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreatePreorderBillingInvoice extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$billing = $this->table("PreorderBilling");
|
||||
$billing->addColumn("netowner_id", "integer", ["null" => false, "after" => "id"]);
|
||||
$billing->update();
|
||||
|
||||
$invoice = $this->table("PreorderBillingInvoice");
|
||||
$invoice->addColumn("netowner_id", "integer", ["null" => false]);
|
||||
$invoice->addColumn("invoice_number", "string", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("invoice_date", "date", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("preorderbillingcustomer_id", "integer", ["default" => null, "null" => true]);
|
||||
$invoice->addColumn("owner_id", "integer", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("billingaddress_id", "integer", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("fibu_account_number", "integer", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("fibu_cost_area", "string", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("fibu_cost_account", "string", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("fibu_revenue_account", "string", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("fibu_taxcode", "integer", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("tax_text", "string", ["null" => true, "default" => null, "length" => 255]);
|
||||
$invoice->addColumn("company", "string", ["null" => true, "default" => null, "length" => 1024]);
|
||||
$invoice->addColumn("firstname", "string", ["null" => true, "default" => null, "length" => 1024]);
|
||||
$invoice->addColumn("lastname", "string", ["null" => true, "default" => null, "length" => 1024]);
|
||||
$invoice->addColumn("street", "string", ["null" => false, "length" => 1024]);
|
||||
$invoice->addColumn("zip", "string", ["null" => false, "length" => 1024]);
|
||||
$invoice->addColumn("city", "string", ["null" => false, "length" => 1024]);
|
||||
$invoice->addColumn("country", "string", ["null" => true, "default" => null, "length" => 1024]);
|
||||
$invoice->addColumn("email", "string", ["null" => true, "default" => null, "length" => 1024]);
|
||||
$invoice->addColumn("uid", "string", ["null" => true, "default" => null, "length" => 1024]);
|
||||
$invoice->addColumn("billing_type", "enum", ["null" => false, "values" => "invoice,sepa"]);
|
||||
$invoice->addColumn("billing_delivery", "enum", ["null" => false, "values" => "email,paper"]);
|
||||
$invoice->addColumn("bank_account_bank", "string", ["null" => true, "default" => null, "length" => 255]);
|
||||
$invoice->addColumn("bank_account_owner", "string", ["null" => true, "default" => null, "length" => 255]);
|
||||
$invoice->addColumn("bank_account_iban", "string", ["null" => true, "default" => null, "length" => 255]);
|
||||
$invoice->addColumn("bank_account_bic", "string", ["null" => true, "default" => null, "length" => 255]);
|
||||
$invoice->addColumn("total", "decimal", ["null" => false, "precision" => 14, "scale" => 2]);
|
||||
$invoice->addColumn("total_gross", "decimal", ["null" => false, "precision" => 14, "scale" => 2]);
|
||||
$invoice->addColumn("vatgroup_id", "integer", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("vatrate", "decimal", ["null" => false, "default" => 0, "precision" => 6, "scale" => 2]);
|
||||
$invoice->addColumn("bmd_export_date", "integer", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("date_delivered", "integer", ["null" => true, "default" => null]);
|
||||
$invoice->addColumn("create_by", "integer", ["null" => false]);
|
||||
$invoice->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$invoice->addColumn("create", "integer", ["null" => false]);
|
||||
$invoice->addColumn("edit", "integer", ["null" => false]);
|
||||
$invoice->create();
|
||||
|
||||
$ip = $this->table("PreorderBillingInvoiceposition");
|
||||
$ip->addColumn("invoice_id", "integer", ["null" => true, "default" => null]);
|
||||
$ip->addColumn("billing_id", "integer", ["null" => true, "default" => null]);
|
||||
$ip->addColumn("start_date", "date", ["null" => true, "default" => null]);
|
||||
$ip->addColumn("end_date", "date", ["null" => true, "default" => null]);
|
||||
$ip->addColumn("product_id", "integer", ["null" => false]);
|
||||
$ip->addColumn("article_number", "integer", ["null" => false]);
|
||||
$ip->addColumn("article_name", "string", ["null" => false, "length" => 255]);
|
||||
$ip->addColumn("article_info", "text", ["null" => true, "default" => null]);
|
||||
$ip->addColumn("amount", "decimal", ["null" => false, "precision" => 9, "scale" => 6]);
|
||||
$ip->addColumn("unit", "string", ["null" => false, "default" => ""]);
|
||||
$ip->addColumn("price", "decimal", ["null" => false, "precision" => 14, "scale" => 2]);
|
||||
$ip->addColumn("price_total", "decimal", ["null" => false, "precision" => 14, "scale" => 2]);
|
||||
$ip->addColumn("price_gross", "decimal", ["null" => false, "precision" => 14, "scale" => 2]);
|
||||
$ip->addColumn("vatrate", "decimal", ["null" => false, "default" => 0, "precision" => 6, "scale" => 2]);
|
||||
$ip->addColumn("billing_period", "integer", ["null" => false, "default" => 0]);
|
||||
$ip->addColumn("create_by", "integer", ["null" => false]);
|
||||
$ip->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$ip->addColumn("create", "integer", ["null" => false]);
|
||||
$ip->addColumn("edit", "integer", ["null" => false]);
|
||||
$ip->create();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("PreorderBillingInvoiceposition")->drop()->save();
|
||||
$this->table("PreorderBillingInvoice")->drop()->save();
|
||||
|
||||
$billing = $this->table("PreorderBilling");
|
||||
$billing->removeColumn("netowner_id");
|
||||
$billing->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user