Install
The PostgreSQL backend requires thepostgres driver. Install it alongside
OpenWorkflow:
Setup
Connection URL
The connection URL follows the standard PostgreSQL format:- Local:
postgresql://postgres:postgres@localhost:5432/openworkflow - With SSL:
postgresql://user:[email protected]:5432/db?sslmode=require
Configuration Options
Migrations
By default,BackendPostgres.connect() runs database migrations automatically.
This creates the configured schema (default: openworkflow) and required tables.
To disable automatic migrations:
Schema
OpenWorkflow creates tables in the configured schema (default:openworkflow):
<schema>.workflow_runs- Stores workflow run state<schema>.step_attempts- Stores step execution history
Namespaces
UsenamespaceId to isolate environments or tenants:
Config File Example
For use with the CLI, createopenworkflow.config.ts:
Connection Pooling
The PostgreSQL backend uses connection pooling internally. For most applications, the default pool settings work well. The pool is managed automatically and connections are reused across workflow executions.Requirements
- PostgreSQL 14 or later
- The connecting user needs permissions to:
- Create schemas (for migrations)
- Create tables (for migrations)
- Read/write to the configured schema (default:
openworkflow)