Overview
MySQL 8 managed via Drizzle ORM. Schema is defined inshared/schema.ts — this is the single source of truth for all tables and types.
Local database (Docker)
- Host:
localhost:3306 - Database:
sahyogi - User:
dbuser - Password:
sin90is1
Production database
Hosted on a managed MySQL instance (PlanetScale or equivalent — confirm with team lead for exact host). Connect withDATABASE_SSL=true.
Ask the team lead for prod DB credentials. Never commit credentials to git.
Migration commands
drizzle.config.ts — outputs migrations to ./db/migrations/, reads schema from ./shared/schema.ts.
Key tables
| Table | Purpose |
|---|---|
users | User accounts, Stripe info, coin balance |
bots | AI bot configurations |
channels | Channel integrations (whatsapp, telegram, gmail, web, twitter, linkedin) |
gupshup_whatsapp_integrations | Gupshup WhatsApp account config |
whatsapp_accounts | WhatsApp Business API accounts |
conversations | Conversation threads |
messages | Individual messages |
whatsapp_message_info | Delivery/read receipts |
campaigns | Campaign templates and state |
contacts | Customer contacts |
contact_lists | Contact list groups |
credentials | Encrypted API keys / OAuth tokens |
integrations | Third-party integration records |
tools | Bot tools/extensions |
webhooks | User-defined webhooks |
training_files | Uploaded PDFs for RAG |
training_urls | URLs scraped for RAG |
plans | Subscription plan definitions |
subscriptions | User subscription state |
teams / team_members | Team management |
roles / permissions | RBAC definitions |