Files
thetool/db/migrations/20250708151354_address_add_payment_due.php
2025-07-08 18:34:07 +02:00

50 lines
2.0 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class AddressAddPaymentDue extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$address = $this->table("Address");
$address->addColumn("fibu_payment_due", "integer", ["null" => true, "default" => null, "after" => "fibu_account_number"]);
$address->addColumn("fibu_payment_skonto", "integer", ["null" => true, "default" => null, "after" => "fibu_payment_due"]);
$address->addColumn("fibu_payment_skonto_rate", "integer", ["null" => true, "default" => null, "after" => "fibu_payment_skonto"]);
$address->update();
$invoice = $this->table("Invoice");
$invoice->addColumn("fibu_payment_due", "integer", ["null" => true, "default" => null, "after" => "fibu_account_number"]);
$invoice->addColumn("fibu_payment_skonto", "integer", ["null" => false, "default" => 0, "after" => "fibu_payment_due"]);
$invoice->addColumn("fibu_payment_skonto_rate", "integer", ["null" => false, "default" => 0, "after" => "fibu_payment_skonto"]);
$invoice->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$address = $this->table("Address");
$address->removeColumn("fibu_payment_skonto_rate");
$address->removeColumn("fibu_payment_skonto");
$address->removeColumn("fibu_payment_due");
$address->update();
$invoice = $this->table("Invoice");
$invoice->removeColumn("fibu_payment_skonto_rate");
$invoice->removeColumn("fibu_payment_skonto");
$invoice->removeColumn("fibu_payment_due");
$invoice->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
}