DO $$
BEGIN
  IF NOT EXISTS (
    SELECT 1 FROM information_schema.columns
    WHERE table_name='tasks' AND column_name='action_taken'
  ) THEN
    ALTER TABLE public.tasks ADD COLUMN action_taken jsonb;
  END IF;
END
$$;