diff --git a/api/migrations/082_tickets_lead_categories.sql b/api/migrations/082_tickets_lead_categories.sql new file mode 100644 index 0000000..d5b2c97 --- /dev/null +++ b/api/migrations/082_tickets_lead_categories.sql @@ -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[]) +);