Skip to content

feat: add data migrations blog#7872

Merged
ankur-arch merged 4 commits intomainfrom
DR-8452-data-migrations
May 6, 2026
Merged

feat: add data migrations blog#7872
ankur-arch merged 4 commits intomainfrom
DR-8452-data-migrations

Conversation

@ankur-arch
Copy link
Copy Markdown
Contributor

@ankur-arch ankur-arch commented May 6, 2026

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive guide on data migrations in Prisma Next covering migration approaches, TypeScript-based migration steps, compiled migration structure, contracts/snapshots, guardrails, agent-assisted workflows, SQL and MongoDB examples, and a hands‑on "Try it yourself" setup; notes Prisma Next is not yet production-ready.
    • Updated two existing blog posts to link to the new migration deep-dive resources.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

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

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment May 6, 2026 3:01pm
docs Ready Ready Preview, Comment May 6, 2026 3:01pm
eclipse Ready Ready Preview, Comment May 6, 2026 3:01pm
site Ready Ready Preview, Comment May 6, 2026 3:01pm

Request Review

@argos-ci
Copy link
Copy Markdown

argos-ci Bot commented May 6, 2026

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

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - May 6, 2026, 3:18 PM

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Caution

Review failed

Failed to post review comments

Walkthrough

Adds a new blog article documenting data migrations in Prisma Next: compares SQL vs TypeScript approaches, shows a Prisma Next migration.ts with dataTransform (and its compiled ops.json), discusses contracts/guardrails, includes a MongoDB example, try-it-yourself steps, and a production-readiness note. (46 words)

Changes

Prisma Next Data Migrations Documentation

Layer / File(s) Summary
Article Front Matter
apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx
Adds title, slug, date, authors, meta fields, hero/meta image paths, and tags.
Intro & Context
apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx
Introduces migration scenarios and frames two approaches: raw SQL migrations vs TypeScript scripts.
SQL Example & Notes
apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx
Adds raw SQL migration example and notes risks of manual SQL edits and lack of editor guardrails.
Script-based Backfill Example
apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx
Adds a TypeScript backfill example using Prisma Client and discusses type-safety caveats.
Prisma Next Migration Example
apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx
Adds migration.ts example demonstrating addColumn, dataTransform, setNotNull, and clarifies operation factories.
Compiled Ops JSON Explanation
apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx
Explains dataTransform compilation to ops.json with precheck/execute/postcheck structure and shows example JSON.
Contracts & Type Guarantees
apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx
Describes per-migration start/end contract snapshots, intermediate contracts, and type-check guarantees.
MongoDB Example
apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx
Adds a MongoDB-specific dataTransform example and Mongo usage notes.
Try It Yourself & Disclaimer
apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx
Provides setup/init commands and notes Prisma Next is not production-ready (recommends Prisma 7 for production).

Documentation Link Updates

Layer / File(s) Summary
Content Edits
apps/blog/content/blog/rethinking-database-migrations/index.mdx
Replaces final "What's next" sentence with a prompt linking to Prisma Next migration deep-dives (TypeScript & Data migrations).
Content Edits
apps/blog/content/blog/the-next-evolution-of-prisma-orm/index.mdx
Replaces a placeholder migration-note with links to "TypeScript Migrations in Prisma Next" and "Data Migrations in Prisma Next".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • prisma/web#7831: Adds documentation for Prisma Next TypeScript-style migrations (ops.json with precheck/execute/postcheck, contracts, and agent-assisted workflows).
🚥 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 'feat: add data migrations blog' accurately summarizes the main change—adding a new blog post about data migrations in Prisma Next with supporting updates to related articles.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Comment thread apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx (1)

157-158: ⚡ Quick win

Avoid absolute wording in the migration-signing security claim.

“Can’t tweak the SQL behind your back” is stronger than necessary. Prefer precise, testable phrasing (for example: tampering is detected and the migration is rejected).

🤖 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/blog/content/blog/data-migrations-in-prisma-next/index.mdx` around lines
157 - 158, The sentence claiming an agent "can't tweak the SQL behind your back"
is too absolute—update the sentence that mentions ops.json and migration.ts to a
precise, testable claim such as: ops.json is signed against the migration.ts it
came from so tampering with the generated SQL is detectable and a mismatched
signature causes the migration to be rejected (or similar wording that replaces
the absolute "can't" with "is detected and rejected"); locate the sentence
referencing "ops.json" and "migration.ts" and replace the phrase accordingly.
🤖 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/blog/content/blog/data-migrations-in-prisma-next/index.mdx`:
- Line 22: The sentence describing adding a displayName column to User in
contract.prisma is a run-on/comma splice; split it into two sentences for
clarity—one stating that you added a displayName column to User in
contract.prisma and want to make it NOT NULL, and a second stating the snag that
existing rows lack displayName so making the column NOT NULL fails because
existing rows violate the constraint; update the paragraph referencing
displayName, User, and contract.prisma accordingly.

---

Nitpick comments:
In `@apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx`:
- Around line 157-158: The sentence claiming an agent "can't tweak the SQL
behind your back" is too absolute—update the sentence that mentions ops.json and
migration.ts to a precise, testable claim such as: ops.json is signed against
the migration.ts it came from so tampering with the generated SQL is detectable
and a mismatched signature causes the migration to be rejected (or similar
wording that replaces the absolute "can't" with "is detected and rejected");
locate the sentence referencing "ops.json" and "migration.ts" and replace the
phrase accordingly.
🪄 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: 0cc41ddc-14fd-4397-af77-a71e34d4eea1

📥 Commits

Reviewing files that changed from the base of the PR and between e142dc7 and 8a32018.

⛔ Files ignored due to path filters (2)
  • apps/blog/public/data-migrations-in-prisma-next/imgs/hero.svg is excluded by !**/*.svg
  • apps/blog/public/data-migrations-in-prisma-next/imgs/meta.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx

Comment thread apps/blog/content/blog/data-migrations-in-prisma-next/index.mdx
@ankur-arch ankur-arch merged commit 4ab777f into main May 6, 2026
18 checks passed
@ankur-arch ankur-arch deleted the DR-8452-data-migrations branch May 6, 2026 16:24
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.

2 participants