From 3b8bae3186ba68f841e363fedb87e5ae8e339e59 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 23 Dec 2025 01:22:47 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20Tilf=C3=B8j=20'posted'=20status=20til=20?= =?UTF-8?q?tmodule=5Forders=20check=20constraint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- migrations/034_add_posted_status.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 migrations/034_add_posted_status.sql diff --git a/migrations/034_add_posted_status.sql b/migrations/034_add_posted_status.sql new file mode 100644 index 0000000..5669cfa --- /dev/null +++ b/migrations/034_add_posted_status.sql @@ -0,0 +1,10 @@ +-- 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'));