From 8d2d3beeb09a127fcc3ed7868f9e711cad33159a Mon Sep 17 00:00:00 2001 From: a2a-cloud Date: Sat, 18 Jul 2026 04:45:51 +0000 Subject: [PATCH] a2a-source-edit: write db/migrations/001_quote_judge.sql --- db/migrations/001_quote_judge.sql | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 db/migrations/001_quote_judge.sql diff --git a/db/migrations/001_quote_judge.sql b/db/migrations/001_quote_judge.sql new file mode 100644 index 0000000..adc5c11 --- /dev/null +++ b/db/migrations/001_quote_judge.sql @@ -0,0 +1,26 @@ +CREATE TABLE IF NOT EXISTS quote_comparisons ( + tenant_key TEXT NOT NULL, + comparison_id TEXT NOT NULL, + recommendation_vendor TEXT NOT NULL, + result JSONB NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + PRIMARY KEY (tenant_key, comparison_id) +); + +CREATE INDEX IF NOT EXISTS quote_comparisons_tenant_updated_idx + ON quote_comparisons (tenant_key, updated_at DESC); + +CREATE TABLE IF NOT EXISTS quote_judge_receipts ( + receipt_id TEXT PRIMARY KEY, + tenant_key TEXT NOT NULL, + comparison_id TEXT NOT NULL, + tool_name TEXT NOT NULL, + status TEXT NOT NULL, + input_hash TEXT NOT NULL, + payload JSONB NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS quote_judge_receipts_tenant_comparison_idx + ON quote_judge_receipts (tenant_key, comparison_id, created_at DESC);