Database Documentation
Flowbot uses MySQL as the primary database. Models are auto-generated via GORM Gen (see internal/store/).
Schema Reference
Full table schema is in schema.md.
Table Categories
Users and Authentication
users— User accountsoauth— OAuth authentication tokenstopics— 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
Workflow System
workflow— Workflow definitionsworkflow_script— Versioned workflow scriptsworkflow_trigger— Triggers (manual, webhook, cron)jobs— Execution jobssteps— Job execution stepsdag— DAG definitions
Bot System
bots— Bot definitionsagents— Desktop agent recordswebhook— Webhook configurations
Messaging
messages— Message recordschannels— Channel management
OKR System
objectives— Objectiveskey_results— Key resultskey_result_values— Key result value trackingreviews/review_evaluations— Review recordscycles— OKR cyclestodos— Todo items
Data Storage
configs— Key-value configuration storagedata— General key-value data storageform— Form schemas and submissionspages— Page configurationsparameter— Temporary parameter storageinstruct— Instruction records
Pipeline & Session
pipelines— Pipeline execution recordssession— Pipeline session state
Analytics
behavior— User behavior statisticscounters/counter_records— Counter systemaction— Action tracking
Other
urls— URL trackingfileuploads— File upload recordsschema_migrations— Migration version tracking
Database Migration
Migrations run automatically at server startup via pkg/migrate/.
Code Generation
task dao # Generate DAO code from database
task doc # Generate schema documentation
Configuration
store_config:
use_adapter: mysql
adapters:
mysql:
dsn: "user:password@tcp(localhost:3306)/flowbot?parseTime=True&collation=utf8mb4_unicode_ci"
Backup
mysqldump -u user -p flowbot > backup_$(date +%Y%m%d_%H%M%S).sql
mysql -u user -p flowbot < backup_file.sql