Save each comparison and let users reload past ones.
- migration 0008: topology_runs (workspace-scoped; full comparison as JSONB).
- cm-db repo::topology_runs (insert / list_recent / get) + regenerated .sqlx.
- cm-api: compare persists best-effort (never loses the LLM result on a DB
hiccup); GET /api/topology-runs (recent) + GET /api/topology-runs/{id}.
Integration test asserts persist → list → get.
- frontend: "Recent comparisons" list on the Compare tab; click to reload a
saved run. e2e p8 green (39 suite); offline build + clippy clean.
Server self-migrates at boot (cm_db::MIGRATOR), so 0008 applies on deploy.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
14 lines
591 B
SQL
14 lines
591 B
SQL
-- Saved multi-topology comparison runs (the Topologies "Compare" view). The
|
|
-- full result — per-topology metrics, leaderboard, and Pareto flags — is stored
|
|
-- as JSONB so the schema stays stable as the comparison shape evolves.
|
|
CREATE TABLE topology_runs (
|
|
id UUID PRIMARY KEY,
|
|
workspace_id UUID NOT NULL REFERENCES workspaces (id) ON DELETE CASCADE,
|
|
task TEXT NOT NULL,
|
|
comparison JSONB NOT NULL,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX topology_runs_workspace_idx
|
|
ON topology_runs (workspace_id, created_at DESC);
|