-- 模型修订只追加结果与来源;正文候选仍由B05拥有。 CREATE TABLE public.muse_revision_result ( task_id uuid PRIMARY KEY REFERENCES public.muse_task(task_id), author_id text NOT NULL, attempt_id uuid NOT NULL REFERENCES public.muse_attempt(attempt_id), call_id text NOT NULL, diagnosis_id uuid NOT NULL REFERENCES public.muse_diagnosis(diagnosis_id), candidate_id uuid REFERENCES public.muse_writing_candidate(candidate_id), outcome text NOT NULL CHECK (outcome IN ('candidate','original','rejected')), payload jsonb NOT NULL CHECK (jsonb_typeof(payload) = 'object'), payload_hash text NOT NULL CHECK (payload_hash ~ '^[0-9a-f]{64}$'), created_at timestamptz NOT NULL DEFAULT clock_timestamp(), CHECK ((outcome='candidate') = (candidate_id IS NOT NULL)) ); CREATE TRIGGER muse_revision_result_guard BEFORE UPDATE OR DELETE ON public.muse_revision_result FOR EACH ROW EXECUTE FUNCTION public.muse_guard_literary_history();