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.

This command is not supported on MongoDB. Use db push instead.

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

OptionDescription
-h, --helpDisplay help message
--configCustom path to your Prisma config file
--schemaCustom path to your Prisma schema
--appliedRecord a specific migration as applied
--rolled-backRecord 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_table

Mark a migration as rolled back

npx prisma migrate resolve --rolled-back 20201231000000_add_users_table

Specify a schema path

npx prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma

See also

On this page