Bridge legacy QuoteJudge database columns

This commit is contained in:
2026-07-18 01:16:49 -03:00
parent a232cc28a8
commit 8b6b5188a5
4 changed files with 38 additions and 7 deletions

View File

@@ -0,0 +1,19 @@
-- Bridge the earliest QuoteJudge schema and the current typed schema without
-- dropping data or weakening historical NOT NULL constraints.
ALTER TABLE quote_comparisons
ADD COLUMN IF NOT EXISTS recommendation_vendor TEXT,
ADD COLUMN IF NOT EXISTS weighted_score NUMERIC(10,4);
UPDATE quote_comparisons
SET recommendation_vendor = COALESCE(recommendation_vendor, recommended_vendor),
weighted_score = COALESCE(weighted_score, score)
WHERE recommendation_vendor IS NULL OR weighted_score IS NULL;
ALTER TABLE quote_execution_receipts
ADD COLUMN IF NOT EXISTS tool_name TEXT,
ADD COLUMN IF NOT EXISTS ok BOOLEAN;
UPDATE quote_execution_receipts
SET tool_name = COALESCE(tool_name, skill_name),
ok = COALESCE(ok, status = 'ok')
WHERE tool_name IS NULL OR ok IS NULL;