> ## Documentation Index
> Fetch the complete documentation index at: https://docs-2.manicule.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://docs-2.manicule.dev/docs/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://docs-2.manicule.dev/docs/api/mcp.
> Every agent surface: https://docs-2.manicule.dev/docs/.well-known/llms-manifest.json

# Database Migrations & ORM Setup (/docs/databases/migrations)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 229 · updated: 2026-11-11 -->
Related: [Managed Databases & Storage Overview](/docs/databases/overview.md), [Cloudflare D1 (Edge SQLite)](/docs/databases/cloudflare-d1.md), [Neon Serverless Postgres](/docs/databases/neon-postgres.md), [Supabase Managed Postgres](/docs/databases/supabase-postgres.md), [Data Privacy & Zero Customer Code Training](/docs/security/privacy.md)

> Managing schema migrations, Drizzle ORM, and Prisma in BhaiCode.

BhaiCode handles schema evolutions deterministically, keeping database tables in sync with your code.

***

## Migration Workflow

When you ask Bhai to update your data models:

1. **DDL Generation**: Bhai writes incremental SQL migration files (e.g., `drizzle/0002_add_user_roles.sql`).
2. **Validation**: The migration is checked against the database schema for type compatibility and foreign key constraints.
3. **Execution**: Bhai runs the migration against your development database and updates your TypeScript types.

***

## Supported ORMs

* **Drizzle ORM (Default)**: Lightweight TypeScript ORM with zero runtime overhead, suited for edge runtimes and serverless databases.
* **Prisma**: Type-safe query builder with automated schema generation and Prisma Studio support.
* **Raw SQL**: Parameterized SQL queries for custom optimization.
