-- Migration 034: Add 'posted' status to tmodule_orders check constraint
-- Date: 2025-12-23
-- Issue: e-conomic export sets status='posted' but constraint doesn't allow it

-- Drop the old constraint
ALTER TABLE tmodule_orders DROP CONSTRAINT IF EXISTS check_status;

-- Add new constraint with 'posted' status included
ALTER TABLE tmodule_orders ADD CONSTRAINT check_status 
    CHECK (status IN ('draft', 'exported', 'posted', 'sent', 'cancelled'));
