You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Create index on posts (createdAt, desc) [additive]
121
121
122
-
2 operations. Run `prisma-next migration apply` to execute.
122
+
2 operations. Run `prisma-next migrate` to execute.
123
123
```
124
124
125
125
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.
@@ -199,10 +199,10 @@ When you do need to edit a migration, for example to backfill data before a cons
199
199
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:
200
200
201
201
```text
202
-
$ npx prisma-next migration apply
202
+
$ npx prisma-next migrate
203
203
β Operation alterNullability.setNotNull.user.displayName failed during precheck: ensure no NULL values in "displayName" (PN-RUN-5001)
204
204
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.
206
206
```
207
207
208
208
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`)
214
214
1. Edit your `contract.prisma`
215
215
2. Plan a migration: `migration plan`
216
216
3. Edit the TypeScript and run `./migration.ts`
217
-
4. Apply the migration: `migration apply`
217
+
4. Apply the migration: `prisma-next migrate`
218
218
5. Read the output, iterate
219
219
220
220
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