Feat v0.3.0 workflow schema (#14)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-go-pg (push) Successful in 2m23s
CI/CD / test-sqlite (push) Successful in 2m42s
CI/CD / build-and-deploy (push) Successful in 1m28s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #14.
This commit is contained in:
2026-03-27 17:52:29 +00:00
committed by xcaliber
parent 8580e1d93e
commit 965885a8f7
16 changed files with 414 additions and 161 deletions

View File

@@ -2,8 +2,9 @@
-- Switchboard Core — 007 Workflows
-- ==========================================
-- Workflow definitions, stages, version snapshots.
-- persona_id kept as nullable TEXT (no FK — personas are extensions now).
-- workflow_assignments dropped (channel-dependent, rebuild as needed).
-- v0.3.0: persona_id + history_mode dropped (chat vestiges).
-- transition_rules → stage_config, stage_mode modernized.
-- Added: audience, stage_type, starlark_hook, branch_rules.
-- ==========================================
CREATE TABLE IF NOT EXISTS workflows (
@@ -44,15 +45,18 @@ CREATE TABLE IF NOT EXISTS workflow_stages (
workflow_id UUID NOT NULL REFERENCES workflows(id) ON DELETE CASCADE,
ordinal INTEGER NOT NULL,
name TEXT NOT NULL,
persona_id TEXT,
assignment_team_id UUID REFERENCES teams(id) ON DELETE SET NULL,
form_template JSONB NOT NULL DEFAULT '{}',
stage_mode TEXT NOT NULL DEFAULT 'form_only'
CHECK (stage_mode IN ('form_only', 'form_chat', 'review', 'custom')),
history_mode TEXT NOT NULL DEFAULT 'full'
CHECK (history_mode IN ('full', 'summary', 'fresh')),
stage_mode TEXT NOT NULL DEFAULT 'form'
CHECK (stage_mode IN ('form', 'review', 'delegated', 'automated')),
audience TEXT NOT NULL DEFAULT 'team'
CHECK (audience IN ('team', 'public', 'system')),
stage_type TEXT NOT NULL DEFAULT 'simple'
CHECK (stage_type IN ('simple', 'dynamic', 'automated')),
auto_transition BOOLEAN NOT NULL DEFAULT false,
transition_rules JSONB NOT NULL DEFAULT '{}',
stage_config JSONB NOT NULL DEFAULT '{}',
branch_rules JSONB NOT NULL DEFAULT '[]',
starlark_hook TEXT,
surface_pkg_id TEXT REFERENCES packages(id) ON DELETE SET NULL,
sla_seconds INTEGER,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()

View File

@@ -1,6 +1,9 @@
-- ==========================================
-- Switchboard Core — 007 Workflows (SQLite)
-- ==========================================
-- v0.3.0: persona_id + history_mode dropped (chat vestiges).
-- transition_rules → stage_config, stage_mode modernized.
-- Added: audience, stage_type, starlark_hook, branch_rules.
CREATE TABLE IF NOT EXISTS workflows (
id TEXT PRIMARY KEY,
@@ -35,15 +38,18 @@ CREATE TABLE IF NOT EXISTS workflow_stages (
workflow_id TEXT NOT NULL REFERENCES workflows(id) ON DELETE CASCADE,
ordinal INTEGER NOT NULL,
name TEXT NOT NULL,
persona_id TEXT,
assignment_team_id TEXT REFERENCES teams(id) ON DELETE SET NULL,
form_template TEXT NOT NULL DEFAULT '{}',
stage_mode TEXT NOT NULL DEFAULT 'form_only'
CHECK (stage_mode IN ('form_only', 'form_chat', 'review', 'custom')),
history_mode TEXT NOT NULL DEFAULT 'full'
CHECK (history_mode IN ('full', 'summary', 'fresh')),
stage_mode TEXT NOT NULL DEFAULT 'form'
CHECK (stage_mode IN ('form', 'review', 'delegated', 'automated')),
audience TEXT NOT NULL DEFAULT 'team'
CHECK (audience IN ('team', 'public', 'system')),
stage_type TEXT NOT NULL DEFAULT 'simple'
CHECK (stage_type IN ('simple', 'dynamic', 'automated')),
auto_transition INTEGER NOT NULL DEFAULT 0,
transition_rules TEXT NOT NULL DEFAULT '{}',
stage_config TEXT NOT NULL DEFAULT '{}',
branch_rules TEXT NOT NULL DEFAULT '[]',
starlark_hook TEXT,
surface_pkg_id TEXT REFERENCES packages(id) ON DELETE SET NULL,
sla_seconds INTEGER,
created_at TEXT NOT NULL DEFAULT (datetime('now'))