-- Migration: Add SetNull cascade on Assignment → DemandRequirement FK
-- When a DemandRequirement is deleted, assignments lose their reference but are not deleted.

ALTER TABLE "assignments" DROP CONSTRAINT IF EXISTS "assignments_demandRequirementId_fkey";
ALTER TABLE "assignments" ADD CONSTRAINT "assignments_demandRequirementId_fkey"
  FOREIGN KEY ("demandRequirementId") REFERENCES "demand_requirements"("id")
  ON DELETE SET NULL ON UPDATE CASCADE;
