Files
thetool/db/migrations/20251204000001_update_manualinvoiceposition_structure.php

38 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class UpdateManualinvoicepositionStructure extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("ManualInvoiceposition");
$table->addColumn("position_group", "string", ["null" => true, "default" => null, "length" => 255, "after" => "manualinvoice_id"]);
$table->removeColumn("start_date");
$table->removeColumn("end_date");
$table->removeColumn("billing_period");
$table->save();
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$table = $this->table("ManualInvoiceposition");
$table->addColumn("start_date", "date", ["null" => false, "after" => "contract_id"]);
$table->addColumn("end_date", "date", ["null" => true, "default" => null, "after" => "start_date"]);
$table->addColumn("billing_period", "integer", ["null" => false, "default" => 0, "after" => "fibu_taxcode"]);
$table->removeColumn("position_group");
$table->save();
}
}
}