bmc_hub/migrations/034_add_posted_status.sql
Christian 3b8bae3186 Fix: Tilføj 'posted' status til tmodule_orders check constraint
- Database constraint tillod kun: draft, exported, sent, cancelled
- Code satte status til 'posted' efter e-conomic export
- Tilføjet 'posted' til check_status constraint
- Fixes: new row violates check constraint error
2025-12-23 01:22:47 +01:00

11 lines
453 B
SQL

-- 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'));