This commit is contained in:
2026-11-02 20:27:11 +02:00
parent b44378b899
commit badaada043
300 changed files with 17458 additions and 1056 deletions
+17 -1
View File
@@ -35,7 +35,9 @@ $contextsInstall = in_array('--contexts', $argv ?? [], true);
$noticesInstall = in_array('--notices', $argv ?? [], true);
$warehouseInstall = in_array('--warehouse-drafts', $argv ?? [], true);
$fulfilmentInstall = in_array('--warehouse-events', $argv ?? [], true);
if ((int) $lotInstall + (int) $countInstall + (int) $contextsInstall + (int) $noticesInstall + (int) $warehouseInstall + (int) $fulfilmentInstall > 1) {
$reservationInstall = in_array('--warehouse-reservations', $argv ?? [], true);
$recoveryInstall = in_array('--replenishment-recovery', $argv ?? [], true);
if ((int) $lotInstall + (int) $countInstall + (int) $contextsInstall + (int) $noticesInstall + (int) $warehouseInstall + (int) $fulfilmentInstall + (int) $reservationInstall + (int) $recoveryInstall > 1) {
throw new LogicException('Seleccione uma única migração por instalação.');
}
$migration = $contextsInstall ? '2026_11_01_000045_add_work_context_configuration' : ($countInstall ? '2026_11_01_000044_allow_signed_lot_adjustments' : ($lotInstall ? '2026_11_01_000043_create_inventory_lot_allocations' : '2026_11_01_000042_create_supply_records'));
@@ -52,6 +54,14 @@ if ($fulfilmentInstall) {
$migration = '2026_11_01_000048_create_warehouse_request_events';
$newTable = 'warehouse_request_events';
}
if ($reservationInstall) {
$migration = '2026_11_02_000049_create_warehouse_reservations';
$newTable = 'warehouse_reservations';
}
if ($recoveryInstall) {
$migration = '2026_11_02_000050_create_replenishment_work';
$newTable = 'replenishment_work';
}
if ($connection->table('migrations')->where('migration', $migration)->exists()) {
echo "A migração de fornecimento já está instalada; nenhum registo alterado.\n";
exit;
@@ -115,6 +125,12 @@ try {
$proof['commercial_policy_activated'] = false;
}
$proofName = $fulfilmentInstall ? 'warehouse-fulfilment-install' : ($warehouseInstall ? 'warehouse-drafts-install' : ($noticesInstall ? 'workflow-notices-install' : ($contextsInstall ? 'work-context-install' : ($countInstall ? 'inventory-count-install' : ($lotInstall ? 'inventory-lot-install' : 'supply-install')))));
if ($reservationInstall) {
$proofName = 'warehouse-reservations-install';
}
if ($recoveryInstall) {
$proofName = 'replenishment-recovery-install';
}
file_put_contents(dirname(__DIR__).'/docs/proofs/'.$proofName.'.json', json_encode($proof, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
echo 'Migração dirigida instalada; restauro conferido, '.count($preserved)." tabelas preservadas. Sem atribuições ou dados de negócio.\n";
} finally {