-- Speed up workspace dashboard queries:
-- - JSONB containment on test_runs.application_ids (applicationIds @> ['...'])
-- - Common filter pattern: project_id + status + type + created_at

CREATE INDEX IF NOT EXISTS "test_runs_application_ids_gin_idx"
ON "test_runs"
USING gin ("application_ids" jsonb_path_ops);

CREATE INDEX IF NOT EXISTS "test_runs_project_status_type_created_at_idx"
ON "test_runs"
USING btree ("project_id", "status", "type", "created_at" DESC);

