migrate (Prisma CLI v7) (/docs/cli/v7/migrate)
For the complete Prisma documentation index, see llms.txt. A markdown version of any docs page is available by appending
.mdto its URL.
Update your database schema with migrations
Location: CLI > v7 > migrate
The prisma migrate command group provides tools to create and apply database migrations.
[!NOTE] Prisma Migrate does not apply to MongoDB. Use
db pushinstead.
prisma migrate [command] [options]Global options
Section titled “Global options”| Option | Description |
|---|---|
-h, --help |
Display help message |
--config |
Custom path to your Prisma config file |
--schema |
Custom path to your Prisma schema |
Development commands
Section titled “Development commands”| Command | Description |
|---|---|
prisma migrate dev |
Create a migration from schema changes, apply it, and trigger generators |
prisma migrate reset |
Reset your database and apply all migrations (all data will be lost) |
Production/staging commands
Section titled “Production/staging commands”| Command | Description |
|---|---|
prisma migrate deploy |
Apply pending migrations to the database |
prisma migrate status |
Check the status of your database migrations |
prisma migrate resolve |
Resolve issues with database migrations (baseline, failed migration, hotfix) |
Commands for any stage
Section titled “Commands for any stage”| Command | Description |
|---|---|
prisma migrate diff |
Compare the database schema from two arbitrary sources |
Examples
Section titled “Examples”# Create and apply a migration in development
prisma migrate dev
# Reset the database (development only)
prisma migrate reset
# Apply pending migrations in production
prisma migrate deploy
# Check migration status
prisma migrate status
# Compare database schemas
prisma migrate diff \
--from-config-datasource \
--to-schema=./prisma/schema.prisma \
--scriptSee also
Section titled “See also”Related pages
Section titled “Related pages”db: Manage your database schema and lifecycle during developmentdebug: Display Prisma debug information including schema paths, engine binaries, environment variables, and cache directories for troubleshootingdev: Start a local Prisma Postgres server for developmentformat: Format and validate your Prisma schema file with consistent structuregenerate: Generate artifacts like Prisma Client based on your Prisma schema