68 lines
3.0 KiB
PHP
68 lines
3.0 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Phinx\Migration\AbstractMigration;
|
|
|
|
final class BillingAddFibuData extends AbstractMigration
|
|
{
|
|
public function up(): void
|
|
{
|
|
if($this->getEnvironment() == "thetool") {
|
|
$billing = $this->table("Billing");
|
|
$billing->addColumn("fibu_account_number", "integer", ["null" => true, "default" => null, "after" => "customer_number"]);
|
|
$billing->addColumn("vatgroup_id", "string", ["null" => true, "default" => null, "after" => "vatrate"]);
|
|
$billing->addColumn("vatarea", "string", ["null" => true, "default" => null, "after" => "vatgroup_id"]);
|
|
$billing->save();
|
|
|
|
$invoice = $this->table("Invoice");
|
|
$invoice->addColumn("fibu_account_number", "integer", ["null" => true, "default" => null, "after" => "customer_number"]);
|
|
$invoice->addColumn("fibu_cost_area", "string", ["null" => true, "default" => null, "after" => "fibu_account_number"]);
|
|
$invoice->addColumn("fibu_cost_account", "integer", ["null" => true, "default" => null, "after" => "fibu_cost_area"]);
|
|
$invoice->addColumn("fibu_cost_account_legacy", "integer", ["null" => true, "default" => null, "after" => "fibu_cost_account"]);
|
|
$invoice->addColumn("fibu_taxcode", "integer", ["null" => true, "default" => null, "after" => "fibu_cost_account_legacy"]);
|
|
$invoice->addColumn("tax_text", "string", ["null" => true, "default" => null, "length" => 255, "after" => "fibu_taxcode"]);
|
|
$invoice->save();
|
|
|
|
$ip = $this->table("Invoiceposition");
|
|
$ip->addColumn("fibu_cost_account", "integer", ["null" => true, "default" => null, "after" => "vatrate"]);
|
|
$ip->addColumn("fibu_cost_account_legacy", "integer", ["null" => true, "default" => null, "after" => "fibu_cost_account"]);
|
|
$ip->addColumn("fibu_taxcode", "integer", ["null" => true, "default" => null, "after" => "fibu_cost_account_legacy"]);
|
|
$ip->save();
|
|
}
|
|
|
|
if($this->getEnvironment() == "addressdb") {
|
|
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
if($this->getEnvironment() == "thetool") {
|
|
|
|
$this->table("Invoiceposition")
|
|
->removeColumn("fibu_taxcode")
|
|
->removeColumn("fibu_cost_account_legacy")
|
|
->removeColumn("fibu_cost_account")
|
|
->update();
|
|
|
|
$this->table("Invoice")
|
|
->removeColumn("fibu_invoice_text")
|
|
->removeColumn("fibu_taxcode")
|
|
->removeColumn("fibu_cost_account_legacy")
|
|
->removeColumn("fibu_cost_account")
|
|
->removeColumn("fibu_cost_area")
|
|
->removeColumn("fibu_account_number")
|
|
->update();
|
|
$this->table("Billing")
|
|
->removeColumn("vatarea")
|
|
->removeColumn("vatgroup_id")
|
|
->removeColumn("fibu_account_number")
|
|
->update();
|
|
}
|
|
|
|
if($this->getEnvironment() == "addressdb") {
|
|
|
|
}
|
|
}
|
|
}
|