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 tokensauthentication— Auxiliary authentication recordstopics— Context/tenant management
Platform Integration
platforms— Registered chat platformsplatform_users— Platform user mappingsplatform_channels— Platform channel mappingsplatform_channel_users— Channel-user associationsplatform_bots— Platform bot registrations
Bot System
bots— Bot definitionsagents— Desktop agent recordsagent_skills— Agent skill registrations
Messaging
messages— Message recordschannels— Channel managementchat_sessions— Agent chat session statechat_session_entries— Agent chat session messages/turns
Hub and Homelab
apps— Homelab scanned appscapability_bindings— Capability-to-backend bindingsconnections— Hub connection records
Pipeline System
pipeline_definitions— Pipeline definition recordspipeline_definition_versions— Versioned pipeline definition historypipeline_runs— Pipeline execution runspipeline_step_runs— Pipeline step execution recordsevent_consumptions— Pipeline idempotency guard
Workflow System
workflow_runs— Workflow execution runsworkflow_step_runs— Workflow step execution records
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 rulesnotification_records— Notification delivery history
Life (solo RPG productivity)
life_profiles— Operator profile (level, exp, gold, class, pity)life_characteristics— Cascading stats (INT/PHY/WIL/CHA/CRE/FIN/WRI/FOC)life_skills— Skills under a characteristiclife_goals— PARA goalslife_quests— One-Time / Daily / Boss questslife_ai_contexts— DM personality + mood (1:1 profile)life_equipments— Equipment catalog templates (seeded)life_inventories— Owned equipment instances + lore overrideslife_equipped_slots— Worn inventory ids per slotlife_loot_tables— Drop tier → chance + item poollife_action_logs— Completion / dice / drop auditlife_rewards— Player-defined real-life rewards (gold sink)life_reward_redemptions— Reward redeem audit (name/price snapshots)
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 storageinstruct— Instruction recordsurls— URL trackingfile_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.
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