Blame · Line-by-line history
0035_prod_signals.sql
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| a6d8fd5 | 1 | -- Block K9 — Production + test signal ingestion. Crontech, Gatetest, Sentry, |
| 2 | -- and manual sources feed per-commit signals back into Gluecron for | |
| 3 | -- attribution, PR annotation, and agent fix loops. | |
| 4 | ||
| 5 | CREATE TABLE IF NOT EXISTS "prod_signals" ( | |
| 6 | "id" uuid PRIMARY KEY DEFAULT gen_random_uuid(), | |
| 7 | "repository_id" uuid NOT NULL REFERENCES "repositories"("id") ON DELETE CASCADE, | |
| 8 | "commit_sha" text NOT NULL, | |
| 9 | "error_hash" text NOT NULL, -- truncated sha-256 of normalised error msg + top frame | |
| 10 | "source" text NOT NULL, -- 'crontech' | 'gatetest' | 'sentry' | 'manual' | |
| 11 | "kind" text NOT NULL, -- 'runtime_error' | 'test_failure' | 'deploy_failure' | 'performance' | 'security' | |
| 12 | "severity" text NOT NULL DEFAULT 'error', -- 'info' | 'warning' | 'error' | 'critical' | |
| 13 | "status" text NOT NULL DEFAULT 'open', -- 'open' | 'dismissed' | 'resolved' | |
| 14 | "message" text NOT NULL DEFAULT '', | |
| 15 | "stack_trace" text, | |
| 16 | "deploy_id" text, | |
| 17 | "environment" text, -- 'production' | 'staging' | etc. | |
| 18 | "sample_payload" text, -- JSON string, optional | |
| 19 | "count" integer NOT NULL DEFAULT 1, | |
| 20 | "first_seen" timestamp NOT NULL DEFAULT now(), | |
| 21 | "last_seen" timestamp NOT NULL DEFAULT now(), | |
| 22 | "resolved_at" timestamp, | |
| 23 | "resolved_by_commit" text, | |
| 24 | "created_at" timestamp NOT NULL DEFAULT now() | |
| 25 | ); | |
| 26 | ||
| 27 | CREATE UNIQUE INDEX IF NOT EXISTS "prod_signals_repo_hash_unique" | |
| 28 | ON "prod_signals" ("repository_id", "error_hash"); | |
| 29 | ||
| 30 | CREATE INDEX IF NOT EXISTS "prod_signals_repo_sha_idx" | |
| 31 | ON "prod_signals" ("repository_id", "commit_sha"); | |
| 32 | ||
| 33 | CREATE INDEX IF NOT EXISTS "prod_signals_repo_status_seen_idx" | |
| 34 | ON "prod_signals" ("repository_id", "status", "last_seen" DESC); | |
| 35 | ||
| 36 | CREATE INDEX IF NOT EXISTS "prod_signals_source_kind_idx" | |
| 37 | ON "prod_signals" ("source", "kind"); |