From faf3673e0b180634098749124c513f5b5eb5f501 Mon Sep 17 00:00:00 2001 From: a2a-cloud Date: Sat, 18 Jul 2026 03:26:57 +0000 Subject: [PATCH] a2a-source-edit: write db/migrations/001_quotejudge.sql --- db/migrations/001_quotejudge.sql | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 db/migrations/001_quotejudge.sql diff --git a/db/migrations/001_quotejudge.sql b/db/migrations/001_quotejudge.sql new file mode 100644 index 0000000..d6f2fb0 --- /dev/null +++ b/db/migrations/001_quotejudge.sql @@ -0,0 +1,31 @@ +CREATE TABLE IF NOT EXISTS quote_comparisons ( + id BIGSERIAL PRIMARY KEY, + tenant_key TEXT NOT NULL, + comparison_id TEXT NOT NULL, + recommended_vendor TEXT NOT NULL, + score DOUBLE PRECISION NOT NULL, + normalized_total DOUBLE PRECISION NOT NULL, + payload JSONB NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + UNIQUE (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_execution_receipts ( + id BIGSERIAL PRIMARY KEY, + tenant_key TEXT NOT NULL, + comparison_id TEXT NOT NULL, + receipt_id UUID NOT NULL UNIQUE, + skill_name TEXT NOT NULL, + status TEXT NOT NULL, + input_hash TEXT NOT NULL, + result_hash TEXT NOT NULL, + payload JSONB NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS quote_execution_receipts_tenant_comparison_idx + ON quote_execution_receipts (tenant_key, comparison_id, created_at DESC);