Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apps/docs/content/docs/cli/db-migrate.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ You edited the contract, ran `contract emit`, and then ran `db migrate`. The tar

```text
✘ [MIGRATION.PATH_UNREACHABLE] Current contract has no planned migration path
why: No migration edge connects the current state "<current hash>" to the target "<target hash>" in contract space "app".
→ Plan the missing edge: prisma migration plan --from <current hash> --to <target hash> --name <slug>
→ Apply it: prisma db migrate --to <target hash>
why: No migration edge connects "<current hash>" to the target "<target hash>" in contract space "app".
→ Plan the missing edge: prisma migration plan --from <current hash> --name <slug>
→ Apply it: prisma db migrate
```

Do not run the commands as the error prints them. Its [`migration plan`](/cli/migration-plan) command fails with `MIGRATION.REF_NOT_FOUND`, because `--to` only accepts a contract that a migration already produces, and its `db migrate --to` command fails with `MIGRATION.PATH_UNREACHABLE` again until the migration is planned. Run `migration plan` without `--to`, with the current hash from the error and a name for the migration, then apply the result. The first seven characters of the hash are enough:
Run the two commands the error prints. Put `npx` in front of each, and give the migration a name in place of `<slug>`. The error repeats the `--config` you passed, and it ends the second command with `--db <url>` if you passed `--db`, so put your connection string there. The first seven characters of the hash are enough:

```npm
npx prisma migration plan --from <current hash> --name add-phone
Expand All @@ -100,7 +100,7 @@ Without `--to`, `migration plan` plans up to the contract you just emitted.

### You passed `--to` with an earlier migration

`db migrate` cannot run a migration backwards. To take the database back, you plan a new migration that undoes the later ones. The error is the same as above. Here the two commands it suggests work as printed, because a migration already produces each of the two states. Put `npx` in front of each:
`db migrate` cannot run a migration backwards. To take the database back, you plan a new migration that undoes the later ones. The error's first lines are the same as above. Here its first command names the target with `--to`, because a migration already produces that state, and its second command is the `db migrate` you ran. Put `npx` in front of each:

```npm
npx prisma migration plan --from <current hash> --to <target hash> --name undo-phone
Expand Down
Loading