Skip to content
Merged
Show file tree
Hide file tree
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 @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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.
Expand All @@ -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.
Expand Down
Loading