runningInConsole() || ! app()->environment(['local', 'testing', 'payable-testing']) || $db->getDriverName() !== 'pgsql' || $db->getConfig('host') !== '127.0.0.1' || ! is_array($scope) || ($scope['database'] ?? null) !== $db->getDatabaseName() || ($scope['username'] ?? null) !== $db->getConfig('username') || ! preg_match('/^compras_(receipts_test|distribution_restore)_[a-f0-9]{12}$/D', $db->getDatabaseName())) { throw new LogicException('Distribution pilot schema requires the exact authorised installer scope.'); } $identity = $db->selectOne('select current_database() as db, current_user as role'); if ($identity === null || $identity->db !== $scope['database'] || $identity->role !== $scope['username']) { throw new LogicException('Distribution pilot schema identity mismatch.'); } BudgetDistributionSchema::install(); } public function down(): void { throw new LogicException('Preserve distribution history; use reviewed recovery or a compatible forward correction.'); } };