improved ipam
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
@@ -7,54 +8,73 @@ final class RmlworkorderMultiTenant extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$companyTable = $this->table('RMLWorkorderCompany');
|
||||
if (!$companyTable->hasColumn('visibleForAddressId')) {
|
||||
$companyTable->addColumn('visibleForAddressId', 'text', ['null' => true, 'default' => null, 'after' => 'name'])
|
||||
->save();
|
||||
}
|
||||
|
||||
if (!$this->hasTable('RMLWorkorderTenantConfig')) {
|
||||
$tenantConfigTable = $this->table('RMLWorkorderTenantConfig', ['id' => false, 'primary_key' => ['id']]);
|
||||
$tenantConfigTable->addColumn('id', 'integer', ['identity' => true, 'signed' => false])
|
||||
->addColumn('addressId', 'integer')
|
||||
->addColumn('name', 'string', ['limit' => 255])
|
||||
->addColumn('documentationTypes', 'json')
|
||||
->addColumn('workorderCreationFilters', 'json')
|
||||
->addColumn('create', 'integer')
|
||||
->addColumn('createBy', 'integer')
|
||||
->addIndex(['addressId'], ['name' => 'addressId_idx'])
|
||||
->create();
|
||||
}
|
||||
|
||||
$this->table('RMLWorkorderTenantConfig')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'addressId' => 4807,
|
||||
'name' => 'RML Standard',
|
||||
'documentationTypes' => '[{\"value\": \"photo_hup_mounted\", \"text\": \"Foto vom montierten HÜP\"}, {\"value\": \"photo_hup_open\", \"text\": \"Foto von dem offenen HÜP\"}, {\"value\": \"photo_splice_cassette_hup\", \"text\": \"Foto der Spleißkassette – HÜP\"}, {\"value\": \"photo_splice_cassette_fcp\", \"text\": \"Foto der Spleißkassette - FCP\"}, {\"value\": \"photo_hup_closed_stickers\", \"text\": \"Foto vom geschlossenen HÜP mit allen Aufklebern\"}, {\"value\": \"photo_fcp_labeled\", \"text\": \"Foto vom FCP beschriftet\"}, {\"value\": \"photo_patch_position_osp\", \"text\": \"Foto der Patch-Position - OSP-Seite\"}, {\"value\": \"photo_patch_position_anb\", \"text\": \"Foto der Patch-Position - ANB-Seite\"}, {\"value\": \"measurement_protocol_otdr\", \"text\": \"ODTR – Messung (1310nm & 1550nm)\"}]',
|
||||
'workorderCreationFilters' => '{\"status_code\": 220, \"preorder_status_flags_all\": [3, 5]}',
|
||||
'create' => 1724704509,
|
||||
'createBy' => 1
|
||||
]
|
||||
])->save();
|
||||
|
||||
$this->execute("UPDATE RMLWorkorderCompany SET visibleForAddressId = '[4807]' WHERE visibleForAddressId IS NULL;");
|
||||
if ($this->getEnvironment() !== "thetool") {
|
||||
return;
|
||||
}
|
||||
|
||||
$companyTable = $this->table('RMLWorkorderCompany');
|
||||
if (!$companyTable->hasColumn('visibleForAddressId')) {
|
||||
$companyTable->addColumn('visibleForAddressId', 'text', ['null' => true, 'default' => null, 'after' => 'name'])->save();
|
||||
}
|
||||
|
||||
if (!$this->hasTable('RMLWorkorderTenantConfig')) {
|
||||
$this->table('RMLWorkorderTenantConfig', ['id' => false, 'primary_key' => ['id']])
|
||||
->addColumn('id', 'integer', ['identity' => true, 'signed' => false])
|
||||
->addColumn('addressId', 'integer')
|
||||
->addColumn('name', 'string', ['limit' => 255])
|
||||
->addColumn('documentationTypes', 'json')
|
||||
->addColumn('workorderCreationFilters', 'json')
|
||||
->addColumn('create', 'integer')
|
||||
->addColumn('createBy', 'integer')
|
||||
->addIndex(['addressId'], ['name' => 'addressId_idx'])
|
||||
->create();
|
||||
}
|
||||
|
||||
$docTypes = [
|
||||
['value' => 'photo_hup_mounted', 'text' => 'Foto vom montierten HÜP'],
|
||||
['value' => 'photo_hup_open', 'text' => 'Foto von dem offenen HÜP'],
|
||||
['value' => 'photo_splice_cassette_hup', 'text' => 'Foto der Spleißkassette – HÜP'],
|
||||
['value' => 'photo_splice_cassette_fcp', 'text' => 'Foto der Spleißkassette - FCP'],
|
||||
['value' => 'photo_hup_closed_stickers', 'text' => 'Foto vom geschlossenen HÜP mit allen Aufklebern'],
|
||||
['value' => 'photo_fcp_labeled', 'text' => 'Foto vom FCP beschriftet'],
|
||||
['value' => 'photo_patch_position_osp', 'text' => 'Foto der Patch-Position - OSP-Seite'],
|
||||
['value' => 'photo_patch_position_anb', 'text' => 'Foto der Patch-Position - ANB-Seite'],
|
||||
['value' => 'measurement_protocol_otdr', 'text' => 'ODTR – Messung (1310nm & 1550nm)'],
|
||||
];
|
||||
|
||||
$workorderFilters = [
|
||||
'status_code' => 220,
|
||||
'preorder_status_flags_all' => [3, 5],
|
||||
];
|
||||
|
||||
$this->table('RMLWorkorderTenantConfig')->insert([
|
||||
[
|
||||
'id' => 1,
|
||||
'addressId' => 4807,
|
||||
'name' => 'RML Standard',
|
||||
'documentationTypes' => json_encode($docTypes),
|
||||
'workorderCreationFilters' => json_encode($workorderFilters),
|
||||
'create' => 1724704509,
|
||||
'createBy' => 1
|
||||
]
|
||||
])->save();
|
||||
|
||||
$this->execute("UPDATE RMLWorkorderCompany SET visibleForAddressId = '[4807]' WHERE visibleForAddressId IS NULL;");
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
if ($this->hasTable('RMLWorkorderTenantConfig')) {
|
||||
$this->table('RMLWorkorderTenantConfig')->drop()->save();
|
||||
}
|
||||
if ($this->getEnvironment() !== "thetool") {
|
||||
return;
|
||||
}
|
||||
|
||||
$companyTable = $this->table('RMLWorkorderCompany');
|
||||
if ($companyTable->hasColumn('visibleForAddressId')) {
|
||||
$companyTable->removeColumn('visibleForAddressId')
|
||||
->save();
|
||||
}
|
||||
if ($this->hasTable('RMLWorkorderTenantConfig')) {
|
||||
$this->table('RMLWorkorderTenantConfig')->drop()->save();
|
||||
}
|
||||
|
||||
$companyTable = $this->table('RMLWorkorderCompany');
|
||||
if ($companyTable->hasColumn('visibleForAddressId')) {
|
||||
$companyTable->removeColumn('visibleForAddressId')->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user