isEmpty()) { $this->warn('No active suites in the registry — skipping view rebuild.'); return self::SUCCESS; } $driver = DB::connection()->getDriverName(); $arms = $suites->map(fn (string $suite) => $this->arm($suite, $driver))->implode(' UNION ALL '); DB::statement('DROP VIEW IF EXISTS all_results'); DB::statement("CREATE VIEW all_results AS {$arms}"); $this->info('all_results view rebuilt over: '.$suites->implode(', ')); return self::SUCCESS; } /** * One UNION arm per suite. All metric tables share the core column set, * so the arm promotes the suite name as a literal plus the common columns. */ private function arm(string $suite, string $driver): string { $table = Suites::modelFor($suite)::make()->getTable(); $quoted = $driver === 'pgsql' ? "'{$suite}'" : "'{$suite}'"; return "SELECT id, benchmark_run_id, ran_at, task, level, ok, decode, user_tps, ttft, t_answer, wall, reasoning, visible, total, finish, detail, {$quoted} AS suite FROM {$table}"; } }