a2a-source-edit: write db/migrations/001_quotejudge_schema.sql
This commit is contained in:
27
db/migrations/001_quotejudge_schema.sql
Normal file
27
db/migrations/001_quotejudge_schema.sql
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS quote_comparisons (
|
||||||
|
tenant_key TEXT NOT NULL,
|
||||||
|
comparison_id TEXT NOT NULL,
|
||||||
|
recommendation_vendor TEXT NOT NULL,
|
||||||
|
weighted_score NUMERIC(10,4) NOT NULL,
|
||||||
|
payload 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_execution_receipts (
|
||||||
|
tenant_key TEXT NOT NULL,
|
||||||
|
receipt_id UUID NOT NULL,
|
||||||
|
comparison_id TEXT NOT NULL,
|
||||||
|
tool_name TEXT NOT NULL,
|
||||||
|
ok BOOLEAN NOT NULL,
|
||||||
|
payload JSONB NOT NULL,
|
||||||
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
PRIMARY KEY (tenant_key, receipt_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS quote_execution_receipts_lookup_idx
|
||||||
|
ON quote_execution_receipts (tenant_key, comparison_id, created_at DESC);
|
||||||
Reference in New Issue
Block a user