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.

416 B
Raw Blame
-- Modify the feedback table to allow userId to be null
ALTER TABLE "feedback" ALTER COLUMN "userId" DROP NOT NULL;

-- Drop the existing foreign key constraint
ALTER TABLE "feedback" DROP CONSTRAINT "feedback_userId_fkey";

-- Add a new foreign key constraint with ON DELETE SET NULL
ALTER TABLE "feedback" ADD CONSTRAINT "feedback_userId_fkey" 
  FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE SET NULL;