make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); App\Shared\Testing\TestingDatabaseGuard::assertSafe(); $db = Illuminate\Support\Facades\DB::connection(); $db->beginTransaction(); try { $db->statement('SET TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ ONLY'); $identity = $db->selectOne("SELECT current_database() AS database,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster"); if ($identity->database !== 'sgf_tempo_test' || $identity->role !== 'sgf_test_runner' || (int) $identity->port !== 55439 || $identity->cluster !== 'sgf_modular_regression_'.$state['id']) throw new RuntimeException('Unexpected effective regression identity'); $tables = []; foreach (['a_clients', 'a_services', 'a_service_drafts', 'a_billing_drafts', 'identity_audit', 'users', 'permission_grants', 'company_memberships'] as $table) { $tables[$table] = $db->selectOne("SELECT count(*) AS rows,md5(coalesce(string_agg(row_to_json(t)::text,E'\\n' ORDER BY row_to_json(t)::text),'')) AS fingerprint FROM {$table} t"); } echo json_encode(['identity' => $identity, 'tables' => $tables, 'read_only' => true], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR).PHP_EOL; } finally { $db->rollBack(); }