Database Migrations
Update schema models, generate types, and apply migrations safely.
Follow this workflow whenever you add, remove, or modify database models in VibeKit.
Making schema changes
Edit the schema file
Open packages/database/prisma/schema.prisma and update your models:
model Project {
id String @id @default(cuid())
name String
teamId String
createdAt DateTime @default(now())
}Regenerate client and Zod types
Run code generation to update @prisma/client and runtime Zod schemas:
bun run db:generateApply changes only to a disposable local database
For local development against a disposable database, you can push schema changes directly:
bun run db:pushCreate a migration for production
When preparing a feature for production, create a formal Prisma migration file:
(cd packages/database && bun x prisma migrate dev --name add_project_model)Commit the generated SQL migration files in packages/database/prisma/migrations/ to Git.
Production database rule
Never use db:push on a shared, staging, or production database. Deploy reviewed, tracked migrations with bun run --cwd packages/database db:migrate (prisma migrate deploy) as one explicit release step.
Learn how to write browser tests in Browser Testing.
For deployed databases, use bun run --cwd packages/database db:migrate with the intended DATABASE_URL. Create migrations against a local development database; do not run migrate dev in production. Confirm the new migration applies from both a fresh disposable database and a representative supported upgrade state before deployment.