From ce9ed374471f813c16f664c96c238924ead22f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Bramer=20Schmidt?= Date: Tue, 7 Jul 2026 19:07:20 +0700 Subject: [PATCH] fix(blog): update removed `migration apply` command to `migrate` 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 ` 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 --- .../content/blog/mongodb-without-compromise/index.mdx | 2 +- .../blog/typescript-migrations-in-prisma-next/index.mdx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/blog/content/blog/mongodb-without-compromise/index.mdx b/apps/blog/content/blog/mongodb-without-compromise/index.mdx index 35938f7208..0596eec8ba 100644 --- a/apps/blog/content/blog/mongodb-without-compromise/index.mdx +++ b/apps/blog/content/blog/mongodb-without-compromise/index.mdx @@ -119,7 +119,7 @@ Migration: 20260409T1200_add_post_indexes Create index on posts (authorId) [additive] Create index on posts (createdAt, desc) [additive] -2 operations. Run `prisma-next migration apply` to execute. +2 operations. Run `prisma-next migrate` to execute. ``` 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. diff --git a/apps/blog/content/blog/typescript-migrations-in-prisma-next/index.mdx b/apps/blog/content/blog/typescript-migrations-in-prisma-next/index.mdx index e7aba5e0a7..8580074aea 100644 --- a/apps/blog/content/blog/typescript-migrations-in-prisma-next/index.mdx +++ b/apps/blog/content/blog/typescript-migrations-in-prisma-next/index.mdx @@ -184,7 +184,7 @@ $ npx prisma-next migration plan ├─ Add column "displayName" to "user" [additive] └─ Set NOT NULL on "user"."displayName" [destructive] -$ npx prisma-next migration apply --verbose +$ npx prisma-next migrate --verbose ✔ Applied 1 migration(s) └─ 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 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: ```text -$ npx prisma-next migration apply +$ npx prisma-next migrate ✖ Operation alterNullability.setNotNull.user.displayName failed during precheck: ensure no NULL values in "displayName" (PN-RUN-5001) Why: Migration runner halted before destructive ALTER - Fix: Fix the issue and re-run `prisma-next migration apply`. Previously applied migrations are preserved. + Fix: Fix the issue and re-run `prisma-next migrate`. Previously applied migrations are preserved. ``` 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`) 1. Edit your `contract.prisma` 2. Plan a migration: `migration plan` 3. Edit the TypeScript and run `./migration.ts` -4. Apply the migration: `migration apply` +4. Apply the migration: `prisma-next migrate` 5. Read the output, iterate 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.