added mph workorders to thetool
This commit is contained in:
95
db/migrations/20251116120000_create_workorder_mph_tables.php
Normal file
95
db/migrations/20251116120000_create_workorder_mph_tables.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class CreateWorkorderMphTables extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("WorkerPermission");
|
||||
$table->addColumn("canWorkorderMphAdmin", "enum", [
|
||||
"null" => false,
|
||||
"values" => ['false', 'true'],
|
||||
"default" => "false",
|
||||
"after" => "canWorkorderAdmin"
|
||||
]);
|
||||
$table->update();
|
||||
|
||||
$workorderMph = $this->table('WorkorderMph', ['id' => 'id', 'primary_key' => 'id']);
|
||||
$workorderMph
|
||||
->addColumn('hausnummerId', 'integer', ['null' => false])
|
||||
->addColumn('companyId', 'integer', ['null' => true])
|
||||
->addColumn('status', 'string', ['limit' => 50, 'null' => false, 'default' => 'new'])
|
||||
->addColumn('assignmentDate', 'integer', ['null' => true])
|
||||
->addColumn('deadlineDate', 'integer', ['null' => true])
|
||||
->addColumn('appointmentDate', 'integer', ['null' => true])
|
||||
->addColumn('additionalInfo', 'text', ['null' => true])
|
||||
->addColumn('easement', 'boolean', ['null' => true, 'default' => null, 'comment' => 'Leitungsrecht'])
|
||||
->addColumn('btb', 'boolean', ['null' => true, 'default' => null])
|
||||
->addColumn('fttxLocationSupplied', 'boolean', ['null' => true, 'default' => null, 'comment' => 'FTTx Location mit Leerrohr versorgt'])
|
||||
->addColumn('conduitToHuepLaid', 'boolean', ['null' => true, 'default' => null, 'comment' => 'Leerrohr bis HÜP/HAK verlegt'])
|
||||
->addColumn('huepMounted', 'boolean', ['null' => true, 'default' => null, 'comment' => 'HÜP/HAK montiert'])
|
||||
->addColumn('dropCableAvailable', 'boolean', ['null' => true, 'default' => null, 'comment' => 'Dropkabel vorhanden'])
|
||||
->addColumn('create', 'integer', ['null' => false])
|
||||
->addColumn('createBy', 'integer', ['null' => false])
|
||||
->addIndex(['hausnummerId'], ['name' => 'hausnummerId_idx'])
|
||||
->addIndex(['companyId'], ['name' => 'companyId_mph_idx'])
|
||||
->addIndex(['status'], ['name' => 'status_mph_idx'])
|
||||
->create();
|
||||
|
||||
$workorderMphWohneinheit = $this->table('WorkorderMphWohneinheit', ['id' => 'id', 'primary_key' => 'id']);
|
||||
$workorderMphWohneinheit
|
||||
->addColumn('workorderMphId', 'integer', ['null' => false])
|
||||
->addColumn('wohneinheitId', 'integer', ['null' => false])
|
||||
->addColumn('status', 'integer', ['null' => false, 'default' => 1, 'comment' => '1=new, 12=241 BEP MD, 13=242 Inhouse, 18=243 Stairwell, 14=244 BEP SD, 15=245 Approved, 16=300 ONT'])
|
||||
->addColumn('note', 'text', ['null' => true])
|
||||
->addColumn('create', 'integer', ['null' => false])
|
||||
->addColumn('createBy', 'integer', ['null' => false])
|
||||
->addColumn('edit', 'integer', ['null' => true])
|
||||
->addColumn('editBy', 'integer', ['null' => true])
|
||||
->addIndex(['workorderMphId'], ['name' => 'workorderMphId_idx'])
|
||||
->addIndex(['wohneinheitId'], ['name' => 'wohneinheitId_idx'])
|
||||
->addIndex(['workorderMphId', 'wohneinheitId'], ['unique' => true, 'name' => 'workorder_wohneinheit_unique'])
|
||||
->create();
|
||||
|
||||
$workorderMphJournal = $this->table('WorkorderMphJournal', ['id' => false, 'primary_key' => ['id']]);
|
||||
$workorderMphJournal
|
||||
->addColumn('id', 'integer', ['identity' => true, 'signed' => true])
|
||||
->addColumn('workorderMphId', 'integer', ['null' => false])
|
||||
->addColumn('text', 'text', ['null' => true])
|
||||
->addColumn('fileIds', 'json', ['null' => true])
|
||||
->addColumn('statusChange', 'string', ['limit' => 255, 'null' => true])
|
||||
->addColumn('create', 'integer', ['null' => false])
|
||||
->addColumn('createBy', 'integer', ['null' => false])
|
||||
->addIndex(['workorderMphId'], ['name' => 'workorderMphId_idx'])
|
||||
->create();
|
||||
|
||||
$workorderMphDocumentation = $this->table('WorkorderMphDocumentation', ['id' => 'id', 'primary_key' => 'id']);
|
||||
$workorderMphDocumentation
|
||||
->addColumn('workorderMphId', 'integer', ['null' => false])
|
||||
->addColumn('fileId', 'integer', ['null' => false])
|
||||
->addColumn('description', 'text', ['null' => true])
|
||||
->addColumn('documentType', 'string', ['limit' => 100, 'null' => false])
|
||||
->addColumn('create', 'integer', ['null' => false])
|
||||
->addColumn('createBy', 'integer', ['null' => false])
|
||||
->addIndex(['workorderMphId'], ['name' => 'workorderMphId_idx'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table('WorkorderMphDocumentation')->drop()->save();
|
||||
$this->table('WorkorderMphJournal')->drop()->save();
|
||||
$this->table('WorkorderMphWohneinheit')->drop()->save();
|
||||
$this->table('WorkorderMph')->drop()->save();
|
||||
|
||||
$table = $this->table("WorkerPermission");
|
||||
$table->removeColumn("canWorkorderMphAdmin");
|
||||
$table->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user