overhauled workorder module
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class WorkorderAddStatusesAndConfigAndPermission extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() !== 'thetool') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->table('Workorder')
|
||||
->changeColumn('status', 'enum', [
|
||||
'values' => [
|
||||
'new',
|
||||
'assigned',
|
||||
'scheduled',
|
||||
'correction_requested',
|
||||
'intervention_required',
|
||||
'civil_engineering_required',
|
||||
'civil_engineering_completed',
|
||||
'problem_solved',
|
||||
'documented',
|
||||
'completed',
|
||||
'cancelled',
|
||||
'archived',
|
||||
'charged'
|
||||
],
|
||||
'default' => 'new',
|
||||
'null' => false,
|
||||
])
|
||||
->save();
|
||||
|
||||
$workorderTenantConfigTable = $this->table('WorkorderTenantConfig');
|
||||
if (!$workorderTenantConfigTable->hasColumn('workorderActiveFilters'))
|
||||
$workorderTenantConfigTable->addColumn('workorderActiveFilters', 'text', [
|
||||
'null' => true,
|
||||
'default' => null,
|
||||
'limit' => \Phinx\Db\Adapter\MysqlAdapter::TEXT_LONG,
|
||||
])
|
||||
->save();
|
||||
|
||||
$workerPermissionTable = $this->table('WorkerPermission');
|
||||
if (!$workerPermissionTable->hasColumn('canRMLCompanyManager'))
|
||||
$workerPermissionTable->addColumn('canRMLCompanyManager', 'enum', [
|
||||
'values' => ['false', 'true'],
|
||||
'null' => false,
|
||||
'default' => 'false',
|
||||
])
|
||||
->save();
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() !== 'thetool') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->table('Workorder')
|
||||
->changeColumn('status', 'enum', [
|
||||
'values' => [
|
||||
'new',
|
||||
'assigned',
|
||||
'scheduled',
|
||||
'correction_requested',
|
||||
'intervention_required',
|
||||
'civil_engineering_required',
|
||||
'civil_engineering_completed',
|
||||
'problem_solved',
|
||||
'documented',
|
||||
'completed',
|
||||
'cancelled'
|
||||
],
|
||||
'default' => 'new',
|
||||
'null' => false,
|
||||
])
|
||||
->save();
|
||||
|
||||
$workorderTenantConfigTable = $this->table('WorkorderTenantConfig');
|
||||
if ($workorderTenantConfigTable->hasColumn('workorderActiveFilters'))
|
||||
$workorderTenantConfigTable->removeColumn('workorderActiveFilters')->save();
|
||||
|
||||
$workerPermissionTable = $this->table('WorkerPermission');
|
||||
if ($workerPermissionTable->hasColumn('canRMLCompanyManager'))
|
||||
$workerPermissionTable->removeColumn('canRMLCompanyManager')->save();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user