# resolve (Prisma CLI v7)

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.

:::callout{intent="warning"}
This command is not supported on [MongoDB](/guides/core-concepts-supported-databases-mongodb). Use [`db push`](/guides/db-commands-db-push) instead.
:::

## Usage

```bash
prisma migrate resolve [options]
```

The datasource URL configuration is read from the Prisma config file (e.g., `prisma.config.ts`).

:::callout{intent="note"}
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

:::code-group
```bash title="bun"
bunx prisma migrate resolve --applied 20201231000000_add_users_table
```

```bash title="pnpm"
pnpm prisma migrate resolve --applied 20201231000000_add_users_table
```

```bash title="yarn"
yarn prisma migrate resolve --applied 20201231000000_add_users_table
```

```bash title="npm"
npx prisma migrate resolve --applied 20201231000000_add_users_table
```
:::

### Mark a migration as rolled back

:::code-group
```bash title="bun"
bunx prisma migrate resolve --rolled-back 20201231000000_add_users_table
```

```bash title="pnpm"
pnpm prisma migrate resolve --rolled-back 20201231000000_add_users_table
```

```bash title="yarn"
yarn prisma migrate resolve --rolled-back 20201231000000_add_users_table
```

```bash title="npm"
npx prisma migrate resolve --rolled-back 20201231000000_add_users_table
```
:::

### Specify a schema path

:::code-group
```bash title="bun"
bunx prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
```

```bash title="pnpm"
pnpm prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
```

```bash title="yarn"
yarn prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
```

```bash title="npm"
npx prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
```
:::

## See also

- [Resolving migration history issues](https://pris.ly/d/migrate-resolve)

## Related pages

- [Authentication & Tools](./authentication-tools-index.md)
- [Build](./build-index.md)
- [Changelog](../changelog.md)
- [Concepts](./concepts-index.md)
- [Console commands](./console-commands-index.md)
- [Contract Authoring](./contract-authoring-index.md)
- [Core Concepts](./core-concepts-index.md)
- [Data Modeling](./data-modeling-index.md)
- [Database](./database-index.md)
- [DB commands](./db-commands-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
