# prisma-next migration apply (/docs/cli/next/migration-apply)

> For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL.

Apply pending Prisma Next migrations.

Location: CLI > Next > prisma-next migration apply

`prisma-next migration apply` applies pending on-disk migrations to the database.

Use it from a controlled deployment step after reviewing migration packages.

## Usage [#usage]

```bash
prisma-next migration apply --db "$DATABASE_URL"
```

## Options [#options]

| Option            | What it does                                   |
| ----------------- | ---------------------------------------------- |
| `--db <url>`      | Connects to the database.                      |
| `--config <path>` | Reads a specific `prisma-next.config.ts` file. |
| `--ref <name>`    | Applies migrations up to a named target ref.   |
| `--json`          | Prints a machine-readable result.              |

## Recommended flow [#recommended-flow]

```bash
prisma-next migration status --db "$DATABASE_URL"
prisma-next migration apply --db "$DATABASE_URL"
prisma-next migration status --db "$DATABASE_URL"
prisma-next db verify --db "$DATABASE_URL"
```

Run `migration status` before and after applying migrations to see what changed.

## Applying to a ref [#applying-to-a-ref]

If your project uses named migration refs, apply up to a target ref:

```bash
prisma-next migration apply --db "$DATABASE_URL" --ref production
```

Manage refs with [`prisma-next migration ref`](https://www.prisma.io/docs/cli/next/migration-ref).

## Related pages

- [`CLI configuration`](https://www.prisma.io/docs/cli/next/configuration): Configure Prisma Next CLI commands with prisma-next.config.ts and global flags.
- [`prisma-next contract emit`](https://www.prisma.io/docs/cli/next/contract-emit): Emit Prisma Next contract artifacts.
- [`prisma-next contract infer`](https://www.prisma.io/docs/cli/next/contract-infer): Infer a starter contract from an existing database.
- [`prisma-next db init`](https://www.prisma.io/docs/cli/next/db-init): Initialize a database from the current Prisma Next contract.
- [`prisma-next db schema`](https://www.prisma.io/docs/cli/next/db-schema): Inspect a live database schema.