migration 082: widen tickets.category CHECK for lead-capture categories

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-05-31 00:50:32 -05:00
parent 0409167e5a
commit 1e34707258

View file

@ -0,0 +1,20 @@
-- Widen tickets.category to allow lead-capture categories posted by the DOT
-- compliance checker (insurance, business close-out, truck-sale routing).
-- The CHECK constraint previously only allowed the support-widget categories,
-- so these INSERTs failed with a 500.
ALTER TABLE tickets DROP CONSTRAINT IF EXISTS tickets_category_check;
ALTER TABLE tickets ADD CONSTRAINT tickets_category_check CHECK (
category = ANY (ARRAY[
'question',
'support',
'issue',
'service_request',
'quote',
'insurance_lead',
'business_closeout',
'truck_sale_quickcash',
'truck_sale_marketplace'
]::text[])
);