# migration new (/docs/cli/migration-new)

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

Scaffold a Prisma 8 migration package for manual authoring.

Location: CLI > migration new

`migration new` creates a migration package with a `migration.ts` file for manual authoring.

Use it when the generated plan is not enough and you want to write the migration operations yourself. The command is offline. It does not consult the database.

## Usage [#usage]

  

#### bun

```bash
bunx prisma@latest migration new --name split-name
```

#### pnpm

```bash
pnpm dlx prisma@latest migration new --name split-name
```

#### yarn

```bash
yarn dlx prisma@latest migration new --name split-name
```

#### npm

```bash
npx prisma@latest migration new --name split-name
```

## Options [#options]

| Option            | What it does                                                              |
| ----------------- | ------------------------------------------------------------------------- |
| `--name <slug>`   | Sets the migration directory name suffix.                                 |
| `--from <hash>`   | Sets the starting contract hash. Defaults to the latest migration target. |
| `--config <path>` | Read this config file instead of `./prisma.config.ts`.                    |
| `--json`          | Prints a machine-readable result.                                         |

## Examples [#examples]

  

#### bun

```bash
bunx prisma@latest migration new --name split-name
bunx prisma@latest migration new --name custom-fk --from abc123
```

#### pnpm

```bash
pnpm dlx prisma@latest migration new --name split-name
pnpm dlx prisma@latest migration new --name custom-fk --from abc123
```

#### yarn

```bash
yarn dlx prisma@latest migration new --name split-name
yarn dlx prisma@latest migration new --name custom-fk --from abc123
```

#### npm

```bash
npx prisma@latest migration new --name split-name
npx prisma@latest migration new --name custom-fk --from abc123
```

## After scaffolding [#after-scaffolding]

Write the migration body in `migration.ts`, then run the file with Node so it emits `ops.json` and attests the package:

```bash
node migration.ts
```

Inspect the result:

  

#### bun

```bash
bunx prisma@latest migration show <migration-dir>
```

#### pnpm

```bash
pnpm dlx prisma@latest migration show <migration-dir>
```

#### yarn

```bash
yarn dlx prisma@latest migration show <migration-dir>
```

#### npm

```bash
npx prisma@latest migration show <migration-dir>
```

Apply the migration only after review:

  

#### bun

```bash
bunx prisma@latest db migrate --db "$DATABASE_URL"
```

#### pnpm

```bash
pnpm dlx prisma@latest db migrate --db "$DATABASE_URL"
```

#### yarn

```bash
yarn dlx prisma@latest db migrate --db "$DATABASE_URL"
```

#### npm

```bash
npx prisma@latest db migrate --db "$DATABASE_URL"
```

Manual migrations should still end at a contract state that matches the emitted contract.

## Related pages

- [`auth`](https://www.prisma.io/docs/cli/auth): Sign in to your Prisma account from the CLI, sign out, and manage workspace sessions.
- [`branch`](https://www.prisma.io/docs/cli/branch): List platform branches for a project.
- [`bucket`](https://www.prisma.io/docs/cli/bucket): Create and manage object-store buckets.
- [`Configuration`](https://www.prisma.io/docs/cli/configuration): Configure Prisma 8 CLI commands with prisma.config.ts and global flags.
- [`contract emit`](https://www.prisma.io/docs/cli/contract-emit): Emit Prisma 8 contract artifacts.