Skip to content

docs: add Prisma Next Migrations section#8025

Merged
nurul3101 merged 17 commits into
mainfrom
docs/prisma-next-migrations
Jul 8, 2026
Merged

docs: add Prisma Next Migrations section#8025
nurul3101 merged 17 commits into
mainfrom
docs/prisma-next-migrations

Conversation

@sorenbs

@sorenbs sorenbs commented Jul 7, 2026

Copy link
Copy Markdown
Member

What this PR does

Adds the Migrations section to the Prisma Next docs at /docs/orm/next/migrations/* — six pages covering the full workflow, per the migrations docs brief. Every command name, flag, file layout, hash, and CLI output was verified against prisma/prisma-next origin/main by actually running the flows end-to-end (fresh Postgres, plan → placeholder backfill → self-emit → apply → status/log → rollback → failure and atomicity behavior).

New pages

  1. How migrations work — what a migration is (the migration.ts / ops.json / migration.json package), the plan–review–apply loop, precheck/execute/postcheck, and a command overview. Includes the migration-loop animated diagram.
  2. The migration graph — the core mental model: contract states as nodes, migrations as edges; branching, merging, refs, markers, and the ledger; the demo fixtures to explore. Includes the migration-graph animated diagram and a real migration graph render of the diamond fixture.
  3. Generating a migrationmigration plan tutorial: greenfield vs delta planning, the db ref default (and the greenfield foot-gun when it is missing), placeholders, and reviewing with show/graph/check.
  4. Editing a migration — the edit → node migration.ts → recompiled ops.json loop, a fully verified typed dataTransform backfill (NOT NULL on a populated table), rawSql, migration new, and attestation.
  5. Applying a migrationmigrate (not migration apply), --show previews, --to targeting, --advance-ref, status/log, dev vs CI/production flows, extension spaces, and the verified failure model.
  6. Rollbacks and recovery — rollback as a forward edge (--to <dir>^), destructive-op warnings, the verified atomic-rollback-on-failure behavior on Postgres, drift handling (db verify / db update / db init), and the post-rollback --from planning caveat.

Each page ends with honest "What's early" notes (no squash/baseline/split commands, no shadow-database rehearsal, rename inference not built, data-transform wiring ceremony) and "Prompt your coding agent" prompts, matching the Middleware/Extensions pages (#8008).

Diagrams

Three new ConceptAnimation presets: migration-loop, migration-graph, migration-rollback. index.tsx/flow-presets.ts get the same FlowName typing fix as #8008 (identical content, merges cleanly).

Verified behaviors worth flagging

  • Applying is prisma-next migrate; migration apply was removed from the CLI (the old blog posts still say migration apply).
  • migration plan without --from uses the db ref if present, otherwise plans from empty — documented with a warning, and the migrate --advance-ref db loop documented as the happy path.
  • On Postgres a failed migrate run rolls back atomically (whole run is one transaction); "previously applied migrations are preserved" means prior runs. The docs state this precisely instead of repeating the blog's resume-at-failed-step framing, which only applies to out-of-band satisfied ops and MongoDB.
  • A real precheck failure, the postcheck-skip (out-of-band column → 0 ops), and rename-as-drop+add were all reproduced and documented.

Redirects (cutover block, per DR-8687)

Main introduced a cutover convention while this PR was in flight: redirects that retire live Prisma 7 URLs ship only when Prisma Next becomes the default docs version, and accumulate commented-out in next.config.mjs until then. The five migrate redirects from the brief now live there instead of being active: /orm/prisma-migrate{,/getting-started} → how-migrations-work, .../mental-model → the-migration-graph, .../workflows/development-and-production → applying-a-migration, .../workflows/customizing-migrations → editing-a-migration. The block also records the no-clean-equivalent pages for the SEO owner (shadow-database, migration-histories, limitations-and-known-issues, and the workflows pages for seeding, baselining, squashing, down-migrations, hotfixing, native functions/types, prototyping, troubleshooting) — to be reassessed as matching Prisma Next pages land.

Notes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added new migration concept animations for migration loops, the migration graph, and rollback scenarios.
  • Documentation
    • Added end-to-end Prisma Next ORM migration guides (planning, generating, editing, applying, rolling back, recovery, plus drift handling).
    • Updated the migrations documentation navigation/sidebars and linked “graph-based migrations” from the main “Why Prisma Next” page.
  • Chores
    • Updated spell-check terms for migration-related vocabulary.

Six pages under /docs/orm/next/migrations covering the full migration
workflow: how migrations work, the migration graph, generating, editing,
applying, and rollbacks/recovery. All commands, file layouts, and CLI
outputs verified against prisma-next origin/main by running the flows
end-to-end (plan, placeholder backfill, self-emit, apply, status, log,
rollback, failure/atomicity behavior).

Adds three ConceptAnimation presets (migration-loop, migration-graph,
migration-rollback), temporary redirects from the Prisma 7 migrate pages
that have clean equivalents, and cspell entries for migration terms.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Jul 8, 2026 10:38am
docs Ready Ready Preview, Comment Jul 8, 2026 10:38am
eclipse Ready Ready Preview, Comment Jul 8, 2026 10:38am
site Ready Ready Preview, Comment Jul 8, 2026 10:38am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR adds Prisma Next migration documentation pages for the migration model, graph, generation, editing, applying, and rollback flows, plus navigation metadata, redirects, spelling entries, a homepage link update, and new migration-themed concept animation presets.

Changes

Migrations documentation pages and support

Layer / File(s) Summary
How migrations work overview
apps/docs/content/docs/orm/next/migrations/how-migrations-work.mdx
New page explaining migration package layout, ops.json operation schema, safety behavior, CLI commands, and SQL/MongoDB parity.
Migration graph concept page
apps/docs/content/docs/orm/next/migrations/the-migration-graph.mdx
New page describing the contract-hash graph model, refs, branching/merging, and inspection commands.
Generating a migration tutorial
apps/docs/content/docs/orm/next/migrations/generating-a-migration.mdx
New tutorial covering initial and delta migration planning, backfill scaffolding, and offline check commands.
Editing a migration guide
apps/docs/content/docs/orm/next/migrations/editing-a-migration.mdx
New guide on syncing migration.ts/ops.json, dataTransform/rawSql examples, MongoDB notes, and an editing checklist.
Applying a migration guide
apps/docs/content/docs/orm/next/migrations/applying-a-migration.mdx
New guide covering migrate execution, status/log/preview workflow, targeting, failure handling, and concurrency guarantees.
Rollbacks and recovery guide
apps/docs/content/docs/orm/next/migrations/rollbacks-and-recovery.mdx
New guide on rollback-as-planning, failure recovery, and drift remediation.
Section navigation, redirects, and spelling support
apps/docs/content/docs/orm/next/migrations/meta.json, apps/docs/content/docs/orm/next/meta.json, apps/docs/content/docs/orm/next/index.mdx, apps/docs/next.config.mjs, apps/docs/cspell.json
Adds migrations sidebar section/ordering, a homepage migration link, commented legacy redirect mappings, and new dictionary words.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Migration concept presets

Layer / File(s) Summary
New migration concept presets
apps/docs/src/components/concept-animation/presets.ts
Adds migration-loop, migration-graph, and migration-rollback presets with labeled, captioned steps to CONCEPT_PRESETS.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • prisma/web#7931: Introduced the concept-animation preset system extended here with new migration presets.

Poem
A rabbit hopped through migration lore,
Graphs and markers, ops galore,
Rollbacks planned as edges anew,
Sidebars sorted, spellings too,
Hop, commit, and docs ship more! 🐇📘

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a Prisma Next Migrations docs section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

🍈 Lychee Link Check Report

77 links: ✅ 26 OK | 🚫 0 errors | 🔀 4 redirects | 👻 47 excluded

✅ All links are working!


Full Statistics Table
Status Count
✅ Successful 26
🔀 Redirected 4
👻 Excluded 47
🚫 Errors 0
⛔ Unsupported 0
⏳ Timeouts 0
❓ Unknown 0

@argos-ci

argos-ci Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Jul 8, 2026, 10:44 AM

Fresh-eyes review as two personas (newcomer, evaluating expert); applied
the top findings: define contract/emit/marker/attestation on first use,
explain operation classes, de-jargon codecRef, standardize on "migration
directory", fix a timestamp inconsistency, and stabilize the db-ref
heading anchor.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/docs/src/components/concept-animation/flow-presets.ts (1)

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Intentional decoupling looks fine — one thing to watch.

Dropping the Partial<Record<ConceptName, FlowScene>> constraint in favor of Record<string, FlowScene> is the right move to let FlowName stand on its own, but it also removes the compile-time guarantee that FLOW_SCENES keys line up with anything meaningful — a typo'd key now silently becomes a new valid FlowName instead of a type error. Given FlowName is consumed directly in ConceptAnimation's prop union (apps/docs/src/components/concept-animation/index.tsx), that's a low-risk trade-off worth being aware of, not a blocker.

Also applies to: 529-531

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/src/components/concept-animation/flow-presets.ts` at line 1,
`FLOW_SCENES` is now typed too loosely with `Record<string, FlowScene>`, so
typoed keys can silently create new `FlowName` values instead of failing at
compile time. Update the `flow-presets` typing to keep a meaningful key union
tied to the scene map, and make sure the `FlowName` prop union used by
`ConceptAnimation` still derives from that constrained source rather than
arbitrary strings.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/content/docs/orm/next/migrations/editing-a-migration.mdx`:
- Around line 64-85: The migration example is assigning the deserialized
contract to endContractJson, but the docs expect the raw JSON snapshot there. In
the editing-a-migration example, keep endContract for the typed db setup and
change M’s endContractJson override to use the imported end-contract.json value
instead of the deserialized contract, so it stays consistent with
startContractJson and the rest of the migration docs.

In `@apps/docs/src/components/concept-animation/index.tsx`:
- Around line 15-21: `ConceptAnimation` currently resolves `FLOW_SCENES` before
`CONCEPT_PRESETS`, so overlapping names like `compute-model`, `env-layers`, and
`github-connection` always render the flow scene instead of the concept preset.
Update the lookup logic in `ConceptAnimation` to either remove the duplicate
concept entries if the overlap is intended, or make the naming sets disjoint /
add an explicit collision check so `FLOW_SCENES` and `CONCEPT_PRESETS` cannot
silently shadow each other.

---

Nitpick comments:
In `@apps/docs/src/components/concept-animation/flow-presets.ts`:
- Line 1: `FLOW_SCENES` is now typed too loosely with `Record<string,
FlowScene>`, so typoed keys can silently create new `FlowName` values instead of
failing at compile time. Update the `flow-presets` typing to keep a meaningful
key union tied to the scene map, and make sure the `FlowName` prop union used by
`ConceptAnimation` still derives from that constrained source rather than
arbitrary strings.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 60f7194f-ed2a-4b3c-8d3d-6fc56fa800e1

📥 Commits

Reviewing files that changed from the base of the PR and between f74f219 and d2ca62d.

📒 Files selected for processing (14)
  • .claude/launch.json
  • apps/docs/content/docs/orm/next/meta.json
  • apps/docs/content/docs/orm/next/migrations/applying-a-migration.mdx
  • apps/docs/content/docs/orm/next/migrations/editing-a-migration.mdx
  • apps/docs/content/docs/orm/next/migrations/generating-a-migration.mdx
  • apps/docs/content/docs/orm/next/migrations/how-migrations-work.mdx
  • apps/docs/content/docs/orm/next/migrations/meta.json
  • apps/docs/content/docs/orm/next/migrations/rollbacks-and-recovery.mdx
  • apps/docs/content/docs/orm/next/migrations/the-migration-graph.mdx
  • apps/docs/cspell.json
  • apps/docs/next.config.mjs
  • apps/docs/src/components/concept-animation/flow-presets.ts
  • apps/docs/src/components/concept-animation/index.tsx
  • apps/docs/src/components/concept-animation/presets.ts

Comment thread apps/docs/content/docs/orm/next/migrations/editing-a-migration.mdx Outdated
Comment thread apps/docs/src/components/concept-animation/index.tsx
Verified every runnable example against prisma-next origin/main
(remaining fixtures, ref list, migrate --show, hash-prefix targeting,
db verify, migration new, the rawSql sample compiled in a real scaffold).
Two fixes from verification: softened the db verify claim to match its
actual output, and added the real migrate --show path preview.

Full review per house docs style: removed prose em dashes and filler,
standardized terminology, added a MongoDB data-transform section with a
link to the working retail-store example, moved the wiring-ceremony note
next to the code it excuses, consolidated CI guidance (commit both
files, check exit codes), and linked the db-ref explanation to one
canonical home.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
apps/docs/content/docs/orm/next/migrations/rollbacks-and-recovery.mdx (1)

23-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Switch these command snippets to npm fences.
These bash blocks bypass the tabbed package-manager rendering used elsewhere in apps/docs/content. Based on learnings, this docs subtree should use a single npm fenced code block so the tooling can expand it automatically.

Also applies to: 48-50

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/content/docs/orm/next/migrations/rollbacks-and-recovery.mdx` around
lines 23 - 28, The migration rollback snippets are using generic bash fences,
which prevents the docs tooling from rendering the package-manager tabs
consistently. Update the affected code blocks in the rollback/recovery MDX
document to use the npm fence style instead of bash, keeping the existing
command content intact; use the surrounding docs patterns in apps/docs/content
and the migration section as the reference for the correct fenced block format.

Source: Learnings

apps/docs/content/docs/orm/next/migrations/applying-a-migration.mdx (1)

42-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Switch these command snippets to npm fences.
These bash blocks bypass the tabbed package-manager rendering used elsewhere in apps/docs/content. Based on learnings, this docs subtree should use a single npm fenced code block so the tooling can expand it automatically.

Also applies to: 93-105, 131-141

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/content/docs/orm/next/migrations/applying-a-migration.mdx` around
lines 42 - 51, The migration command examples are using bash fences, which
bypass the package-manager tab rendering used in this docs subtree. Update the
affected snippets in the migration docs content to use a single npm fenced code
block instead, so the tooling can expand them automatically; make the change
consistently across the examples shown in the migration guide.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/docs/content/docs/orm/next/migrations/applying-a-migration.mdx`:
- Around line 42-51: The migration command examples are using bash fences, which
bypass the package-manager tab rendering used in this docs subtree. Update the
affected snippets in the migration docs content to use a single npm fenced code
block instead, so the tooling can expand them automatically; make the change
consistently across the examples shown in the migration guide.

In `@apps/docs/content/docs/orm/next/migrations/rollbacks-and-recovery.mdx`:
- Around line 23-28: The migration rollback snippets are using generic bash
fences, which prevents the docs tooling from rendering the package-manager tabs
consistently. Update the affected code blocks in the rollback/recovery MDX
document to use the npm fence style instead of bash, keeping the existing
command content intact; use the surrounding docs patterns in apps/docs/content
and the migration section as the reference for the correct fenced block format.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 49a3b748-418c-48a2-8716-7673e51ac7ee

📥 Commits

Reviewing files that changed from the base of the PR and between 41e2dd0 and e1f14f3.

📒 Files selected for processing (7)
  • apps/docs/content/docs/orm/next/migrations/applying-a-migration.mdx
  • apps/docs/content/docs/orm/next/migrations/editing-a-migration.mdx
  • apps/docs/content/docs/orm/next/migrations/generating-a-migration.mdx
  • apps/docs/content/docs/orm/next/migrations/how-migrations-work.mdx
  • apps/docs/content/docs/orm/next/migrations/rollbacks-and-recovery.mdx
  • apps/docs/content/docs/orm/next/migrations/the-migration-graph.mdx
  • apps/docs/src/components/concept-animation/presets.ts
✅ Files skipped from review due to trivial changes (4)
  • apps/docs/content/docs/orm/next/migrations/the-migration-graph.mdx
  • apps/docs/content/docs/orm/next/migrations/editing-a-migration.mdx
  • apps/docs/content/docs/orm/next/migrations/generating-a-migration.mdx
  • apps/docs/content/docs/orm/next/migrations/how-migrations-work.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/docs/src/components/concept-animation/presets.ts

sorenbs and others added 2 commits July 7, 2026 18:18
Resolves: meta.json (Migrations placed after Fundamentals, before
Middleware), concept-animation presets (both sides additive), and
next.config.mjs — the prisma-migrate redirects move into the new
DR-8687 cutover block as commented-out entries per the convention
main introduced, including the no-equivalent-yet list for the SEO
owner.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CodeRabbit: bind endContractJson to the raw end-contract.json import in
the filled editing example (verified the variant self-emits with
identical hashes); restore the extensions cross-link now that #8008 is
merged; re-add the closing braces the merge common-suffix folding
dropped between the migration and middleware presets.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sorenbs

sorenbs commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

Addressed the review in d9ed6b2 (plus the merge of main in 1c32f78):

  • endContractJson in the editing example — fixed: the class field now binds the raw end-contract.json import, consistent with startContractJson; the deserialized contract remains only for the typed db wiring. Verified the corrected file still self-emits with identical from/to hashes against prisma-next origin/main.
  • FLOW_SCENES/CONCEPT_PRESETS overlap in index.tsx — moot after merging main: this branch no longer diffs that file (it ships docs: add Prisma Next Middleware and Extensions sections #8008's version unchanged, where the flow-first lookup is the documented fallback design). The three migration presets added here don't overlap any flow scene.
  • npm fences in rollbacks-and-recovery — skipped deliberately: these are npx prisma-next … invocations of the project-local CLI, and the npm auto-convert would render them as pnpm dlx prisma-next …, which fetches from the registry instead of running the local install. The merged Next pages use bash for npx invocations too (e.g. middleware authoring); npm fences stay reserved for package installs.

Also from the merge: the five /orm/prisma-migrate redirects moved into the new DR-8687 cutover block as commented-out entries (with the no-equivalent-yet list for the SEO owner), and the Migrations section slots between Fundamentals and Middleware in the sidebar.

The overview page now runs the whole loop inline: three commands with
the verified plan and apply output and an explicit success signal, so a
newcomer is productive before leaving page one. Swept all six pages for
forward references: terms like ledger, marker, and contract space are
now glossed or linked at first use instead of assuming later sections.
Also links the graph page from the Prisma Next index bullet, links the
contract to Data Modeling, and straightens the branch/merge lanes in
the migration-graph animation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every migrations page now opens its "Prompt your coding agent" section
with the same line, linking /ai/tools/skills and phrased as "Ask your
agent to:".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ills catalog

Per review:

- The three migration animations are rebuilt as single-concept flow
  scenes with one-sentence captions, replacing the dense token
  animations: the loop is four boxes in a cycle (change, plan, review,
  apply), the graph teaches exactly one idea (states are nodes,
  migrations are edges, shown through a branch and merge), and rollback
  shows one thing (a new forward edge back to a previous state, history
  grows). The token-preset duplicates that FLOW_SCENES already shadowed
  (migration trio, middleware-pipeline, extension-planes) are removed,
  addressing the CodeRabbit shadowing note for the entries this stack
  introduced.
- "What a migration is" becomes "What a migration contains": a
  three-file table first (the file you edit, the file Prisma runs, the
  history marker), then one short subsection per file with the
  package.json/package-lock.json analogy and the Git-commit-range
  reading of from/to. Less jargon, one idea per paragraph.
- /ai/tools/skills gains an "Available skills for Prisma Next" section
  cataloging the twelve skills create-prisma installs (verified against
  a scaffolded project's skills-lock.json), with the install command
  for existing projects. Every migration page's "Prompt your coding
  agent" section now deep-links that anchor.
- CodeRabbit: the editing example's raw-JSON import is renamed
  startContractJson so the deserialized/raw pair reads consistently.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Validated the whole section end to end on a fresh create-prisma app
against a live Prisma Postgres database and a local MongoDB replica
set. Everything documented works as written: the three-command loop,
the file shapes (migration.json fields, ops.json precheck/execute/
postcheck with operation classes), every command in the tables,
rollback with --from/--to and the destructive warning, the placeholder
flow for backfills, and full MongoDB parity (same commands, same
layout, marker in _prisma_migrations).

Three findings from the runs are now on the pages:

- The migration directory listing includes the *-contract.d.ts
  snapshot types, which are what type-check migration.ts.
- After a rollback, the contract source still holds the change, so
  db verify reports a hash mismatch until you revert and re-emit;
  and the resulting cycle makes the next migration plan require an
  explicit --from (MIGRATION.NO_TARGET names the reachable states).
- Adding an extension to an existing project can hit a contract-space
  layout violation on db init; one migration plan run materializes the
  extension's baseline migration and db init proceeds (verified with
  pgvector on Prisma Postgres, CREATE EXTENSION included).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ankur-arch

Copy link
Copy Markdown
Contributor

Pushed two commits addressing the review, then validated the whole section end to end.

b699109, the review feedback:

  • The three migration animations are rebuilt as single-concept flow scenes with one-sentence captions: the loop is four boxes in a cycle, the graph teaches only "states are nodes, migrations are edges" through a branch and merge, and rollback shows one thing (a new forward edge back, history grows). The shadowed token-preset duplicates are removed.
  • "What a migration contains" now follows the teachable structure: a three-file table (the file you edit, the file Prisma runs, the history marker), one short subsection per file, the package.json/package-lock.json analogy, and the Git-commit-range reading of from/to.
  • /ai/tools/skills gains an Available skills for Prisma Next section cataloging the twelve skills create-prisma installs (verified against a scaffolded project's skills-lock.json); every page's "Prompt your coding agent" section deep-links that anchor.
  • CodeRabbit: the raw-JSON import in the editing example is renamed startContractJson; the preset-shadowing note is addressed for the entries this stack introduced (details in the thread replies).

9c7c561, live validation of everything on these pages (fresh create-prisma app, live Prisma Postgres via create-db, local MongoDB replica set):

  • The three-command loop runs as documented, and the planner/applier outputs match ("Planned 1 operation(s)" with the DDL preview, "Applied 1 migration(s)").
  • File shapes match exactly: migration.json fields, ops.json operations with precheck/execute/postcheck and operation classes.
  • Every command in the tables runs: migration list/show/graph/check/status/log, migrate. (migration show wants the full directory name or hash, which is what the docs show.)
  • Rollback with --from/--to <dir>^ plans the destructive drop with the warning, applies, and the ledger keeps the round trip.
  • MongoDB parity confirmed: same commands, identical directory layout, marker in _prisma_migrations.

Three findings from the runs are now on the pages: the directory listing includes the *-contract.d.ts snapshot types (they're what type-check migration.ts); after a rollback, db verify reports a hash mismatch until the contract is reverted and re-emitted, and the graph cycle makes the next migration plan require an explicit --from (MIGRATION.NO_TARGET); and adding an extension to an existing project can hit a contract-space layout violation on db init until one migration plan materializes the extension's baseline (verified with pgvector on Prisma Postgres, CREATE EXTENSION included).

Style and coherence pass across the Prisma Next tree:

- The intro no longer says "your contract is your schema", which
  contradicted the contract-authoring definition (contract = what you
  author, schema = the database's actual structure). Both sections now
  use the same distinction.
- The generating tutorial drops a mislabeled link (the word "contract"
  pointed at the data modeling section) and a "we'll" opener.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ankur-arch

Copy link
Copy Markdown
Contributor

Style and coherence pass (32007a5), reviewed as a reader navigating the whole Prisma Next tree: the intro's "your contract is your schema" contradicted the contract-authoring definition (contract = what you author, schema = the database's actual structure), so both sections now draw the same distinction; the generating tutorial also drops a mislabeled link and a "we'll" opener. One coordination note: once #8024 merges, the contract mention in the intro here should link /orm/next/contract-authoring/the-data-contract; it stays unlinked for now so this branch's link check remains green whichever PR lands first.

…ations

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	apps/docs/content/docs/orm/next/meta.json
#	apps/docs/cspell.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants