Database Migrations & ORM Setup
Deterministic schema changes with Drizzle ORM, Prisma, or raw SQL.
BhaiCode evolves your schema deliberately, keeping database tables in sync with your code.
How a migration runs
Describe the change
Ask Bhai to add or change your data model, in plain language.
Review the generated SQL
Bhai writes an incremental migration such as
drizzle/0002_add_user_roles.sql and checks it against the live schema for type and
foreign-key compatibility.
Apply and type
The migration runs against your development database, and TypeScript types are updated to match.
ORM options
| Tool | When to use it |
|---|---|
| Drizzle ORM (default) | Lightweight, zero runtime overhead, ideal for edge and serverless databases |
| Prisma | Type-safe client with schema generation and Prisma Studio |
| Raw SQL | Bespoke queries and hand-tuned performance work |
Migrations belong in review
Commit generated migrations alongside the code that needs them, so every environment applies the same change in the same order.
Was this page helpful?