Database Documentation
Flowbot uses PostgreSQL as the primary database. Models are defined as Ent schemas (see internal/store/ent/schema/). Ent maps each schema file to a table.
Schema Reference
The full generated column reference is in schema.md. It is a point-in-time dump and may lag behind the schemas; treat internal/store/ent/schema/ as the source of truth.
Table Categories
Tables are grouped by responsibility below. Each row corresponds to one Ent schema file in internal/store/ent/schema/.
Users and Authentication
users— User accountsoauth— OAuth authentication tokens
Platform Integration
platforms— Registered chat platformsplatform_users— Platform user mappingsplatform_channels— Platform channel mappingsplatform_channel_users— Channel-user associations
Bot System
bots— Module / bot registration state
Messaging
messages— Message recordschannels— Channel management
Hub and Homelab
apps— Homelab scanned apps
Pipeline System
pipeline_definitions— Pipeline definition recordspipeline_definition_versions— Versioned pipeline definition historypipeline_name— Published pipeline name indexpipeline_runs— Pipeline execution runspipeline_step_runs— Pipeline step execution recordsevent_consumptions— Pipeline idempotency guard
Workflow System
workflows— Workflow definitionsworkflow_tasks— Workflow task nodesworkflow_triggers— Workflow triggersworkflow_runs— Workflow execution runsworkflow_step_runs— Workflow step execution records
Named Functions (FaaS)
function_definitions— Function definition recordsfunction_definition_versions— Published function versionsfunction_runs— Function invoke / try runs
Events
data_events— Durable business eventsevent_outbox— Transactional outbox for event publishingpolling_state— Per-provider polling cursor state
Notifications
notify_channels— Per-user notification channel configurationnotify_rules— Notification gateway rulesnotify_templates— Notification templatesnotification_records— Notification delivery history
Web Auth
web_accounts— Web console accounts (password / TOTP)
Agent / Chat Agent
agents— Desktop agent recordsagent_skills/agent_skill_files— Agent skill registrations and filesagent_knowledge— Knowledge documentsagent_memory_facts— Memory factsagent_plans— Agent plansagent_session_summaries— Session summariesagent_subagents/agent_subagent_tasks— Subagent definitions and tasksagent_todos— Agent todo itemschat_sessions/chat_session_entries— Chat session state and turnschat_scheduled_tasks/chat_scheduled_task_runs— Scheduled chat tasksllm_usage_records— LLM token usage
Clips
clips— Clip resources (public/private visibility)
Resources
resource_links— Tag/chain links between resources
Data Storage
configs— Key-value configuration storagedata— General key-value data storageform— Form schemas and submissionspages— Page configurationspage_data— Page data payloadsparameter— Temporary parameter storagefile_uploads— File upload records
Analytics
behavior— User behavior statisticscounters/counter_records— Counter system
Audit
audit_logs— Audit log entries
Database Schema Management
Ent auto-migration via client.Schema.Create() on startup. No manual SQL migrations.
Removing an Ent entity does not drop its PostgreSQL table. After upgrades that delete schemas, run the orphan-table DROP statements in Database schema upgrades.
Code Generation
go tool task ent # Generate ent code from schemas
go tool task templ # Generate templ Go code
Note: the legacy
task docschema-documentation command has been removed.schema.mdis the last generated snapshot and is no longer refreshed automatically.
Configuration
postgres:
dsn: "postgres://user:password@localhost:5432/flowbot?sslmode=disable"
Backup
pg_dump -U user flowbot > backup_$(date +%Y%m%d_%H%M%S).sql
psql -U user flowbot < backup_file.sql