Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

765 B
Raw Blame
-- =============================================================================
-- Move sync_purchase_invoice_line_price_change from BEFORE to AFTER interceptor.
--
-- unitPrice on purchaseInvoiceLine is a GENERATED STORED column. In PostgreSQL,
-- generated columns are not populated in NEW during BEFORE triggers, so the
-- interceptor saw NEW."unitPrice" as NULL and violated the NOT NULL constraint
-- on purchaseInvoicePriceChange."newPrice". Running the interceptor AFTER the
-- row is finalized restores the original legacy-trigger semantics.
-- =============================================================================

SELECT attach_event_trigger('purchaseInvoiceLine',
  ARRAY[]::TEXT[],
  ARRAY['sync_purchase_invoice_line_price_change']::TEXT[]
);