new-site/api/migrations/093_mcs150_awaiting_intake_status.sql

12 lines
880 B
SQL

-- Add 'awaiting_intake' fulfillment status for MCS-150/DOT orders that are
-- held waiting on the customer to confirm operational details the FMCSA
-- census cannot supply (operation classification, cargo, current mileage,
-- email). The worker sets this state and emails a census-pre-filled intake
-- link; the order auto-resumes when the customer submits.
ALTER TABLE compliance_orders DROP CONSTRAINT IF EXISTS compliance_orders_fulfillment_status_check;
ALTER TABLE compliance_orders ADD CONSTRAINT compliance_orders_fulfillment_status_check
CHECK (fulfillment_status IS NULL OR fulfillment_status = ANY (ARRAY[
'authorization_required','authorization_signed','awaiting_customer_delegation',
'awaiting_secure_credentials','awaiting_government_fee_approval','awaiting_insurance_filing',
'awaiting_intake','ready_to_file','filed_waiting_state','completed'
]));