Skip to content

fix: docs: 70-patching-and-hotfixing.mdx: add npx #6955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ To reconcile your migration history and database schema in production:
1. Push the migration to production **without running `migrate deploy`**. Instead, mark the migration created in the previous step as 'already applied' so that Prisma Migrate does not attempt to apply your hotfix a second time:

```terminal
prisma migrate resolve --applied "20201127134938-retroactively-add-index"
npx prisma migrate resolve --applied "20201127134938-retroactively-add-index"
```

This command adds the migration to the migration history table without running the actual SQL.
Expand Down Expand Up @@ -91,7 +91,7 @@ The following example demonstrates how to roll back a migration, optionally make
1. Mark the migration as rolled back - this updates the migration record in the `_prisma_migrations` table to register it as rolled back, allowing it to be applied again:

```terminal
prisma migrate resolve --rolled-back "20201127134938_added_bio_index"
npx prisma migrate resolve --rolled-back "20201127134938_added_bio_index"
```

1. If the migration was partially run, you can either:
Expand All @@ -106,7 +106,7 @@ The following example demonstrates how to roll back a migration, optionally make
1. Re-deploy the migration:

```terminal
prisma migrate deploy
npx prisma migrate deploy
```

### Option 2: Manually complete migration and resolve as applied
Expand All @@ -118,7 +118,7 @@ The following example demonstrates how to manually complete the steps of a migra
1. Resolve the migration as applied - this tells Prisma Migrate to consider the migration successfully applied:

```terminal
prisma migrate resolve --applied "20201127134938_my_migration"
npx prisma migrate resolve --applied "20201127134938_my_migration"
```

## Fixing failed migrations with `migrate diff` and `db execute`
Expand Down Expand Up @@ -160,7 +160,7 @@ model Post {
}
```

You create a migration called 'Unique' with the command `prisma migrate dev -n Unique` which is saved in your local migrations history. Applying the migration succeeds in your dev environment and now it is time to release to production.
You create a migration called 'Unique' with the command `npx prisma migrate dev -n Unique` which is saved in your local migrations history. Applying the migration succeeds in your dev environment and now it is time to release to production.

Unfortunately this migration can only be partially executed. Creating the `Post` model and adding the `email` column succeeds, but making the `name` field unique fails with the following error:

Expand Down