Files
thetool/db/migrations/20251103125000_workorder_add_cable_fields.php
2025-11-03 12:59:00 +01:00

55 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class WorkorderAddCableFields extends AbstractMigration
{
public function up(): void
{
if ($this->getEnvironment() == "thetool") {
$tableWorkorder = $this->table("Workorder");
$tableWorkorder
->addColumn("cableLength", "string", [
'null' => true,
'default' => null,
'after' => 'additionalInfo'
])
->addColumn("cableType", "string", [
'null' => true,
'default' => null,
'after' => 'cableLength'
])
->update();
$tableConfig = $this->table("WorkorderTenantConfig");
$tableConfig
->addColumn("requireCableLength", "boolean", [
'null' => false,
'default' => 0,
'after' => 'civilEngineeringDocsRequired'
])
->addColumn("requireCableType", "boolean", [
'null' => false,
'default' => 0,
'after' => 'requireCableLength'
])
->update();
}
}
public function down(): void
{
if ($this->getEnvironment() == "thetool") {
$this->table("Workorder")
->removeColumn("cableLength")
->removeColumn("cableType")
->save();
$this->table("WorkorderTenantConfig")
->removeColumn("requireCableLength")
->removeColumn("requireCableType")
->save();
}
}
}