-- 触发确认链路(2026-07-30):命中不等于必起 —— 触发器可勾「需人工确认」, -- 命中后先发系统消息到指定人工作台,他点「确认起单」流程才起。 -- 这两列是**运营配置**:设计面的 upsert 不写它们,只有运营口(setConfirm)动。 alter table sys.trigger add column confirm_required boolean not null default false; alter table sys.trigger add column confirm_staff_id text; -- 待确认单:命中但等人点头的那一票。装配好的调用入参存在这里 —— -- 确认那一刻直接起单,不重新装配(事件早已过去,重抽可能抽不到了)。 create table sys.trigger_pending ( id text primary key, trigger_id text not null, package_id text not null, -- 确认人快照:发消息那一刻的指定人;确认路由按它认门 staff_id text not null, subject text not null, data jsonb not null, source jsonb not null, -- 来件预览(from/subject/body 节选)—— 消息上带内容,人不用回头翻邮箱 preview jsonb not null default '{}'::jsonb, created_at timestamptz not null default now(), consumed_at timestamptz, workflow_id text ); create index trigger_pending_open_idx on sys.trigger_pending (trigger_id) where consumed_at is null; -- 节点负责人(运营配置):流程包的哪个节点归谁 —— 起单时垫在显式指派之下、轮值之上。 create table sys.node_owner ( package_id text not null, node_id text not null, staff_id text not null, primary key (package_id, node_id) );