muse-agent-example/数据库/迁移/V0016__流程定义与版本.sql
zizi e99a952dd0 W05 任务状态、租约、事件与恢复:任务状态机、短事务租约、事件续接、恢复控制与作用域互斥。
按 R2 串行阶段整理提交;包内文件为该阶段交付(含后续小增量),状态以工作包清单为准。
2026-09-10 19:25:40 +08:00

21 lines
719 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- W05:已校验流程的不可变执行计划;同版本不能覆盖历史任务定义。
DO $migration$
DECLARE
namespace text;
BEGIN
FOREACH namespace IN ARRAY ARRAY['public', 'evaluation'] LOOP
EXECUTE format($ddl$
CREATE TABLE %I.muse_flow_version (
run_purpose public.muse_purpose NOT NULL,
flow_id text NOT NULL,
version text NOT NULL,
definition jsonb NOT NULL,
definition_hash text NOT NULL,
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
PRIMARY KEY (run_purpose, flow_id, version)
)
$ddl$, namespace);
END LOOP;
END
$migration$;