Skip to main content

Database Schema

apptor flow uses PostgreSQL 16 with Liquibase for schema migrations. All tables include org_id for multi-tenant data isolation.


Core Execution Tables

process

The workflow definition registry. One row per workflow, regardless of how many versions it has.

ColumnTypeDescription
process_idVARCHAR(64) PKUnique workflow ID
process_nameVARCHAR(255)Display name
process_descriptionVARCHAR(255)Optional description
process_type_cdINTProcess type code
active_versionVARCHAR(10)Currently deployed version number
created_tsTIMESTAMP TZCreation timestamp
created_byVARCHAR(255)User who created
updated_tsTIMESTAMP TZLast update timestamp
updated_byVARCHAR(255)Last updater
org_idVARCHAR(64)Organization (tenant) ID

process_version

Every saved version of a workflow definition.

ColumnTypeDescription
process_version_idBIGINT PKAuto-generated
process_idVARCHAR(64) FK → processParent workflow
version_numberVARCHAR(10)e.g. "1", "2", "1.0.3"
state_cdINT0=draft, 1=published, 2=archived
process_textTEXTFull workflow JSON definition
dialectVARCHAR(10)JSON format dialect
environment_idBIGINT FK → environmentsTarget environment
updated_tsTIMESTAMP TZ
updated_byVARCHAR(255)
created_tsTIMESTAMP TZ
created_byVARCHAR(255)
org_idVARCHAR(64)

process_instance

Each workflow execution (a run).

ColumnTypeDescription
process_instance_idVARCHAR(64) PKUnique execution ID
process_idVARCHAR(64)Workflow that was run
process_nameVARCHAR(100)Workflow name at time of execution
process_descriptionVARCHAR(255)
process_versionVARCHAR(10)Version that ran
process_instance_versionINTInternal version counter
dataTEXTFull execution state JSON
state_cdINT0=running, 1=completed, 2=failed, 3=cancelled
start_timeTIMESTAMP TZWhen execution started
end_timeTIMESTAMP TZWhen execution ended
correlation_keyVARCHAR(255)Key for event correlation
parent_instance_idVARCHAR(64)Parent execution (for subprocesses)
org_idVARCHAR(64)

node_instance

A record per node execution within a process instance.

ColumnTypeDescription
node_instance_idVARCHAR(64) PK
process_instance_idVARCHAR(64) FKParent execution
node_idVARCHAR(255)Node ID from workflow definition
node_nameVARCHAR(255)Display name
node_typeVARCHAR(64)Node type string
status_cdINT0=pending, 1=running, 2=completed, 3=failed, 4=cancelled, 5=timed_out
stateTEXTNode-specific state JSON
variablesTEXTVariable snapshot at this node
attached_node_idVARCHAR(64)For boundary events
attached_node_instance_idVARCHAR(64)
group_assignedVARCHAR(64)Assigned user group (user tasks)
owner_user_idVARCHAR(64)Assigned user (user tasks)
delegated_user_idVARCHAR(64)Delegated user
start_timeTIMESTAMP TZ
end_timeTIMESTAMP TZ
parent_node_idVARCHAR(255)Parent node (for subprocesses)
parent_node_instance_idVARCHAR(255)
iterationINTLoop iteration counter
org_idVARCHAR(64)

event_subscription

Suspends a workflow waiting for an external event (Intermediate Catch Event).

ColumnTypeDescription
event_subscription_idBIGINT PKAuto-generated
process_instance_idVARCHAR(64) FKSuspended execution
process_idVARCHAR(64)
process_versionVARCHAR(10)
sub_process_nameVARCHAR(64)If inside a subprocess
node_idVARCHAR(64)The catch event node waiting
node_instance_idVARCHAR(64)
event_typeVARCHAR(100)Type of event expected
message_or_signal_refVARCHAR(64)Event name/reference
correlation_keyVARCHAR(255)Matches the inbound event key
cancel_activityBOOLEANWhether to cancel on boundary event
due_timeTIMESTAMP TZOptional deadline
state_cdINT0=waiting, 1=triggered, 2=cancelled
created_tsTIMESTAMP TZ
org_idVARCHAR(64)

queue_item

Persistent message queue — ensures messages survive server restarts.

ColumnTypeDescription
item_idBIGINT PK
queue_nameVARCHAR(50)Actor queue name
message_idVARCHAR(64)Deduplication ID
messageTEXTSerialized message payload
created_tsTIMESTAMP TZ
org_idVARCHAR(64)

AI Memory Tables

ai_memory_conversation

Conversation context for AI Task nodes with memory enabled.

ColumnTypeDescription
conversation_idVARCHAR(128) PKUnique conversation ID
conversation_typeVARCHAR(32)'conversation' (default)
max_messagesINTMaximum messages to retain (default: 10)
enabledBOOLEANWhether memory is active
configurationTEXTJSON config
created_timeTIMESTAMP TZ
last_accessedTIMESTAMP TZ
org_idVARCHAR(64)

ai_memory_message

Individual messages stored in conversation memory.

ColumnTypeDescription
message_idVARCHAR(128) PK
conversation_idVARCHAR(128) FKParent conversation
sequence_numberBIGINTMessage order
roleVARCHAR(32)'user', 'assistant', 'system'
contentTEXTMessage content
metadataTEXTAdditional JSON metadata
created_timeTIMESTAMP TZ

RBAC Tables

roles

ColumnTypeDescription
role_idUUID PK
nameVARCHARRole name
descriptionVARCHAR
scopeVARCHAR'organization' or 'system'
org_idVARCHAR(64)null for system-wide roles

permissions

ColumnTypeDescription
permission_idUUID PK
permission_keyVARCHAR UNIQUEe.g. 'WORKFLOW_EXECUTE'
nameVARCHARDisplay name
descriptionVARCHAR
group_idUUIDPermission group

role_permissions

ColumnTypeDescription
role_idUUID FK
permission_idUUID FK

api_key_roles

ColumnTypeDescription
api_key_idUUID FK
role_idUUID FK

Authentication Tables

api_keys

ColumnTypeDescription
idUUID PK
key_idVARCHAR UNIQUEPublic key identifier
nameVARCHARHuman-readable label
key_hashVARCHARbcrypt hash of the secret
key_prefixVARCHARFirst chars shown in UI
rate_limit_per_minuteINTRequest rate limit
rate_limit_per_hourINTHourly rate limit
expires_atTIMESTAMP TZExpiry (null = never)
last_used_atTIMESTAMP TZ
statusVARCHARACTIVE, SUSPENDED, REVOKED
created_atTIMESTAMP TZ
organization_idVARCHAR(64)

organization_auth_configs

OIDC/SAML configuration per organization.

idp_connections

Identity provider connection details (client ID, discovery URL, etc.).

federated_users

Mapping between OIDC subject IDs and internal user IDs.


Other Key Tables

TablePurpose
environmentsDEVELOPMENT / PRODUCTION environments per org
integrationsConfigured external service connections
connectorsConnector definitions for integration types
secretsEncrypted org secrets (name, encrypted_value)
published_workflowsPublic workflow URL configurations
public_workflow_executionsExecutions of published workflows
voice_call_stateActive voice call state for Voice Task nodes
user_groupsUser groups for task assignment
user_group_membersGroup membership
workflow_assignmentsWorkflow-to-user/group access assignments
openapi_specsUploaded OpenAPI specifications for REST integrations

Database Access (Local Dev)

PGPASSWORD="postgres" "/c/Program Files/PostgreSQL/16/bin/psql.exe" \
-h localhost -p 5432 -U postgres -d apptor_flow_db -w \
-c "SELECT table_name FROM information_schema.tables WHERE table_schema='public' ORDER BY table_name"

Connection details (local):

  • Host: localhost
  • Port: 5432
  • User: postgres
  • Password: postgres
  • Database: apptor_flow_db