Introduce catalog governance tables and extend workflow schema v2 so only the three official workflows are selectable at runtime. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
1.1 KiB
SQL
30 lines
1.1 KiB
SQL
-- +goose Up
|
|
-- Schema v2: executor registry metadata on workflow_versions (JSONB 已存 definition_json)
|
|
|
|
ALTER TABLE workflow_versions
|
|
ADD COLUMN IF NOT EXISTS schema_version INT NOT NULL DEFAULT 1;
|
|
|
|
UPDATE workflow_versions SET schema_version = COALESCE((definition_json->>'schema_version')::int, 1)
|
|
WHERE schema_version = 1;
|
|
|
|
CREATE TABLE IF NOT EXISTS workflow_executor_registry (
|
|
executor_key TEXT PRIMARY KEY,
|
|
description TEXT NOT NULL DEFAULT '',
|
|
status TEXT NOT NULL DEFAULT 'active',
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
INSERT INTO workflow_executor_registry (executor_key, description) VALUES
|
|
('bizdev.intake.v1', '商务 intake'),
|
|
('bizdev.research.v1', '竞品调研'),
|
|
('bizdev.feasibility.v1', '法规可行性'),
|
|
('bizdev.prelim_design.v1', '初步设计'),
|
|
('bizdev.cdo_quote.v1', 'CDO 报价'),
|
|
('squad.system_reqs.v1', '系统需求基线'),
|
|
('squad.test_manager.v1', '测试经理验证策划')
|
|
ON CONFLICT (executor_key) DO NOTHING;
|
|
|
|
-- +goose Down
|
|
DROP TABLE IF EXISTS workflow_executor_registry;
|
|
ALTER TABLE workflow_versions DROP COLUMN IF EXISTS schema_version;
|