# dev

The `prisma migrate dev` command creates and applies migrations during development. It requires a [shadow database](/guides/prisma-migrate-v7-understanding-prisma-migrate-shadow-database).

**For use in development environments only.**

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

## [Usage](#usage)

```
prisma migrate dev [options]
```

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

## [How it works](#how-it-works)

1. Reruns the existing migration history in the shadow database to detect schema drift
2. Applies pending migrations to the shadow database
3. Generates a new migration from any changes you made to the Prisma schema
4. Applies all unapplied migrations to the development database and updates the `_prisma_migrations` table

:::callout{intent="note"}
**Prisma v7**: `migrate dev` no longer automatically triggers `prisma generate` or seed scripts. Run them explicitly if needed.
:::

## [Options](#options)

| Option          | Description                                             |
| --------------- | ------------------------------------------------------- |
| `-h`, `--help`  | Display help message                                    |
| `--config`      | Custom path to your Prisma config file                  |
| `--schema`      | Custom path to your Prisma schema                       |
| `--url`         | Override the datasource URL from the Prisma config file |
| `-n`, `--name`  | Name the migration                                      |
| `--create-only` | Create a new migration but do not apply it              |

:::callout{intent="note"}
If a [schema drift](/guides/prisma-migrate-v7-understanding-prisma-migrate-shadow-database#detecting-schema-drift) is detected while running with `--create-only`, you will be prompted to reset your database.
:::

## [Examples](#examples)

### [Create and apply migrations](#create-and-apply-migrations)

:::code-group
```title="bun"
bunx prisma migrate dev
```

```bash title="pnpm"
pnpm prisma migrate dev
```

```bash title="yarn"
yarn prisma migrate dev
```

```bash title="npm"
npx prisma migrate dev
```
:::

### [Name the migration](#name-the-migration)

:::code-group
```title="bun"
bunx prisma migrate dev --name added_job_title
```

```bash title="pnpm"
pnpm prisma migrate dev --name added_job_title
```

```bash title="yarn"
yarn prisma migrate dev --name added_job_title
```

```bash title="npm"
npx prisma migrate dev --name added_job_title
```
:::

### [Create migration without applying](#create-migration-without-applying)

:::code-group
```title="bun"
bunx prisma migrate dev --create-only
```

```bash title="pnpm"
pnpm prisma migrate dev --create-only
```

```bash title="yarn"
yarn prisma migrate dev --create-only
```

```bash title="npm"
npx prisma migrate dev --create-only
```
:::

This creates the migration file but doesn't apply it. Run `prisma migrate dev` again to apply.

### [Specify a schema path](#specify-a-schema-path)

:::code-group
```title="bun"
bunx prisma migrate dev --schema=./alternative/schema.prisma
```

```bash title="pnpm"
pnpm prisma migrate dev --schema=./alternative/schema.prisma
```

```bash title="yarn"
yarn prisma migrate dev --schema=./alternative/schema.prisma
```

```bash title="npm"
npx prisma migrate dev --schema=./alternative/schema.prisma
```
:::

## [See also](#see-also)

- [Conceptual overview of Prisma Migrate](/guides/prisma-migrate-v7-prisma-migrate)
- [Developing with Prisma Migrate](/guides/prisma-migrate-v7-prisma-migrate)

## 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.
