resolve
Resolve issues with database migrations in deployment databases
The prisma migrate resolve command allows you to solve migration history issues in production by marking a failed migration as already applied (supports baselining) or rolled back.
Usage
prisma migrate resolve [options]The datasource URL configuration is read from the Prisma config file (e.g., prisma.config.ts).
This command can only be used with a failed migration. Using it with a successful migration results in an error.
Use cases
- Recover from failed migrations
- Baseline databases when starting to use Prisma Migrate on existing databases
- Reconcile hotfixes done manually on databases with your migration history
Run prisma migrate status to identify if you need to use resolve.
Options
| Option | Description |
|---|---|
-h, --help | Display help message |
--config | Custom path to your Prisma config file |
--schema | Custom path to your Prisma schema |
--applied | Record a specific migration as applied |
--rolled-back | Record a specific migration as rolled back |
You must specify either --applied or --rolled-back.
Examples
Mark a migration as applied
npx prisma migrate resolve --applied 20201231000000_add_users_tableMark a migration as rolled back
npx prisma migrate resolve --rolled-back 20201231000000_add_users_tableSpecify a schema path
npx prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma