-- Migration: Add sag_id to tmodule_order_lines
-- Date: 2025-02-02
-- Description: Allows order lines to reference Sag module cases

ALTER TABLE tmodule_order_lines 
ADD COLUMN IF NOT EXISTS sag_id INTEGER REFERENCES sag_sager(id) ON DELETE SET NULL;

CREATE INDEX IF NOT EXISTS idx_tmodule_order_lines_sag ON tmodule_order_lines(sag_id);
