Skip to content
New to BhaiCode? Install the desktop app in under a minute, or build in your browser with Cloud Studio.
BhaiCode Docs
BhaiCode Docs
Databases & Storage › Database Migrations & ORM Setup

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

ToolWhen to use it
Drizzle ORM (default)Lightweight, zero runtime overhead, ideal for edge and serverless databases
PrismaType-safe client with schema generation and Prisma Studio
Raw SQLBespoke 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?