Prisma Migration Workflow
Development Workflow
# After changing schema.prisma:
npx prisma migrate dev --name describe_your_change
# This:
# 1. Creates a new migration file
# 2. Applies it to your dev database
# 3. Regenerates the Prisma Client
Resetting the Database (Dev Only)
npx prisma migrate reset
# Drops DB, re-applies all migrations, runs seed
Production Deployment
npx prisma migrate deploy
# Applies pending migrations only (no reset)
Viewing Migration Status
npx prisma migrate status
Seeding
Add to package.json:
"prisma": {
"seed": "ts-node prisma/seed.ts"
}
Then run:
npx prisma db seed