Skip to content

Commit 38a7b5c

Browse files
sorenbsclaude
andauthored
fix(blog): update removed migration apply command to migrate (#8028)
The Prisma Next CLI replaced `prisma-next migration apply` with the top-level `prisma-next migrate` (the CLI now prints "Use `prisma-next migrate --to <contract>` instead" for the old verb). Readers copying commands from the TypeScript-migrations and MongoDB posts hit an unknown-command error. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 75e6a88 commit 38a7b5c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

  • apps/blog/content/blog

β€Žapps/blog/content/blog/mongodb-without-compromise/index.mdxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Migration: 20260409T1200_add_post_indexes
119119
Create index on posts (authorId) [additive]
120120
Create index on posts (createdAt, desc) [additive]
121121

122-
2 operations. Run `prisma-next migration apply` to execute.
122+
2 operations. Run `prisma-next migrate` to execute.
123123
```
124124

125125
It includes pre-checks, post-checks, full history, branching, and rollback, following the same structure as Prisma Next's SQL migrations. Your indexes, validators, and collection options are versioned alongside your code and deployed through CI/CD.

β€Žapps/blog/content/blog/typescript-migrations-in-prisma-next/index.mdxβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ $ npx prisma-next migration plan
184184
β”œβ”€ Add column "displayName" to "user" [additive]
185185
└─ Set NOT NULL on "user"."displayName" [destructive]
186186
187-
$ npx prisma-next migration apply --verbose
187+
$ npx prisma-next migrate --verbose
188188
βœ” Applied 1 migration(s)
189189
190190
└─ 20260424T0930_add_user_displayname [2 op(s)]
@@ -199,10 +199,10 @@ When you do need to edit a migration, for example to backfill data before a cons
199199
Where it gets interesting is when something goes wrong. The runner doesn't just bail with a database error. It names the operation that failed and the check inside it that the database refused to satisfy:
200200

201201
```text
202-
$ npx prisma-next migration apply
202+
$ npx prisma-next migrate
203203
βœ– Operation alterNullability.setNotNull.user.displayName failed during precheck: ensure no NULL values in "displayName" (PN-RUN-5001)
204204
Why: Migration runner halted before destructive ALTER
205-
Fix: Fix the issue and re-run `prisma-next migration apply`. Previously applied migrations are preserved.
205+
Fix: Fix the issue and re-run `prisma-next migrate`. Previously applied migrations are preserved.
206206
```
207207

208208
You know which operation failed (`alterNullability.setNotNull.user.displayName`) and which check failed inside it (`ensure no NULL values in "displayName"`). Both come straight from `ops.json`, and both tell you exactly where to look. From here, you fix it. You might backfill the nulls, drop and re-add the column with a default, or edit the migration to add a backfill step before the `setNotNull`. Then you re-run.
@@ -214,7 +214,7 @@ You know which operation failed (`alterNullability.setNotNull.user.displayName`)
214214
1. Edit your `contract.prisma`
215215
2. Plan a migration: `migration plan`
216216
3. Edit the TypeScript and run `./migration.ts`
217-
4. Apply the migration: `migration apply`
217+
4. Apply the migration: `prisma-next migrate`
218218
5. Read the output, iterate
219219

220220
The contract describes the database schema you want. `migration.ts` lets you edit the migration easily. The JSON is what runs. The feedback is granular enough to act on.

0 commit comments

Comments
Β (0)