Get Started
Prisma CLI
Get to know how to use Prisma CLI inside the project
Prerequisite
Run commands from /apps/api.
With Bun, use bunx to run Prisma CLI.
Create a migration
After updating schema.prisma:
bunx prisma migrate dev --name <name>- Applies the migration to your local DB
- Regenerates the Prisma Client
Deploy migrations (prod)
bunx prisma migrate deploy- Runs all pending SQL migrations in
prisma/migrations
This is what your migrate script does:
"migrate": "bunx prisma migrate deploy"Push schema without migration
bunx prisma db push- Updates the DB to match your schema
- Doesn’t create migration files
- Useful for local prototyping
Reset the database
bunx prisma migrate reset- Drops the DB
- Reapplies all migrations
- Runs seed if configured
Generate Prisma Client
bunx prisma generateIf you’re not using
bun dev, which runs this automatically
Migration folder
Migrations are saved in:
/apps/api/prisma/migrations/<timestamp>_<name>/Each contains:
migration.sqlmigration_lock.toml
Typical workflow
# Edit schema
# Create migration
bunx prisma migrate dev --name <name>
# Commit
git add prisma/schema.prisma prisma/migrations/
git commit -m "migration: <name>"
# Deploy
bun run migrate