Postgres schema

ArcFlow stores server-side state in PostgreSQL. Migrations live in runtime/arcflow-core/migrations/ and apply via arcflow migrate up or the arcflow-migrate init container before server start.

Verify readiness after migrate:

bash
curl -s -o /dev/null -w "%{http_code}\n" http://localhost:8080/ready

Migration index

FilePurpose
20240531000001_recovery_state.sqlLinear recovery rows
20240531000002_recovery_graph_columns.sqlGraph checkpoint columns on recovery
20240531000003_arcflow_runs.sqlRun tracking and idempotency
20240531000004_human_approvals.sqlHITL approvals + run snapshots
20240531000005_trace_events.sqlPersisted trace data policy trace events
20240531000006_workflow_registry.sqlSemver workflow registry
20240531000007_arcflow_sites.sqlStatic product sites and tokens

Apply manually:

bash
export ARCFLOW_POSTGRESQL_URL=postgres://arcflow:arcflow@localhost:5432/arcflow
cargo run -p arcflow-cli -- migrate up

arcflow_recovery_state

Supports partial execution recovery.

ColumnTypeNotes
recovery_idTEXT PKRecovery record id
original_run_idTEXT UNIQUERun being recovered
workflow_def_idTEXTWorkflow definition id
state_jsonJSONBSerialized recovery payload
created_atTIMESTAMPTZInsert time
is_consumedBOOLEANPrevents double resume
execution_modeTEXTlinear or graph (migration 000002)
current_node_idTEXTGraph checkpoint (Graph recovery resume partial)
graph_iteration_countINTEGERGraph guard
pending_joinJSONBJoin node state

Indexes: original_run_id, unconsumed by workflow.

arcflow_runs

HTTP run lifecycle and idempotency.

ColumnTypeNotes
run_idTEXT PKUUID string
trace_idTEXTTrace correlation
statusTEXTExecutionStatus PascalCase
workflow_hashTEXTWorkflow id fingerprint
exec_config_jsonJSONBParsed exec_config
result_jsonJSONBTerminal success payload
error_jsonJSONBTerminal error
idempotency_keyTEXT UNIQUEOptional dedup key
workflow_jsonJSONBSnapshot (migration 000004)
agents_jsonJSONBAgent snapshot
input_textTEXTRun input
created_at, started_at, completed_atTIMESTAMPTZTimestamps

Indexes: status, created_at DESC.

arcflow_human_approvals

HITL approval records.

ColumnTypeNotes
run_id, approval_keyTEXTComposite PK
statusTEXTpending / resolved
approvedBOOLEANDecision
data_jsonJSONBApprover payload
expires_atTIMESTAMPTZHumanTimeout boundary
created_at, resolved_atTIMESTAMPTZAudit

Partial index on pending approvals by expiry.

arcflow_trace_events

Persisted trace for GET /v1/runs/{id}/trace.

ColumnTypeNotes
run_id, seqTEXT, BIGINTComposite PK, ordered
event_jsonJSONBmetadata-only trace event
created_atTIMESTAMPTZInsert time

arcflow_workflows and arcflow_workflow_aliases

Registry semver storage.

arcflow_workflows

ColumnTypeNotes
idUUID PKRow id
name, versionTEXTUNIQUE pair
schema_hashTEXTDefinition hash
definition_jsonJSONBFull workflow
published_byTEXTOptional publisher
published_atTIMESTAMPTZPublish time
deprecatedBOOLEANSoft deprecation

arcflow_workflow_aliases

ColumnTypeNotes
name, aliasTEXTComposite PK
versionTEXTTarget version

Requires pgcrypto extension (migration 000006).

arcflow_sites, arcflow_site_tokens, arcflow_site_usage_daily

Static product operator model.

arcflow_sites

ColumnTypeNotes
idTEXT PKSite id
display_nameTEXTOperator label
allowed_originsTEXT[]Relay Origin allowlist
rate_limit_rpmINTEGERDefault 60
allow_inlineBOOLEANBrowser inline workflow override
default_workflow_nameTEXTe.g. chat
kb_namespaceTEXTQdrant namespace
upstream_runtime_keyTEXTScoped server key id
chat_instructionsTEXTPublish template hint

arcflow_site_tokens

Hashed tokens per site; revoked_at for rotation.

arcflow_site_usage_daily

Daily run counters per site for operator metrics.

Operational notes

  • Relay does not connect to Postgres; it reads site config from env JSON or future sync.
  • Qdrant collections for vector memory are not in these migrations; configure ARCFLOW_QDRANT_URL separately.
  • Backup arcflow_runs and arcflow_trace_events together for audit replay.