Database Migrations & ORM Setup
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:
- DDL Generation: Bhai writes incremental SQL migration files (e.g.,
drizzle/0002_add_user_roles.sql). - Validation: The migration is checked against the database schema for type compatibility and foreign key constraints.
- 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.