Database Migrations in Prisma

From the Prisma ORM cheat sheet · Prisma Migrations & Database Management · verified Jul 2026

Database Migrations

Version control your database schema changes with Prisma Migrate

bash
# Create a new migration
npx prisma migrate dev --name add_user_table

# Apply migrations in production
npx prisma migrate deploy

# Create migration without applying (preview)
npx prisma migrate dev --create-only

# Reset database (removes all data!)
npx prisma migrate reset

# Check migration status
npx prisma migrate status

# Resolve failed migrations
npx prisma migrate resolve --applied "20231201123456_migration_name"

// BASH_BLOCK:
# Development workflow
npx prisma migrate dev    # Create and apply migration
npx prisma generate        # Regenerate Prisma Client
npx prisma studio          # Open GUI to view/edit data

# Production deployment
npx prisma migrate deploy  # Apply pending migrations
npx prisma generate        # Generate Prisma Client

# Migration management
npx prisma migrate diff \
  --from-schema-datamodel prisma/schema.prisma \
  --to-schema-datasource prisma/schema.prisma \
  --script > migration.sql
💡 Always review migration SQL before applying
⚠️ Don't edit migration files after applying
📌 Use --create-only to preview migrations
✅ Reset dev DB with npx prisma migrate reset

More Prisma tasks

Back to the full Prisma ORM cheat sheet