Skip to content

Conversation

@ankur-arch
Copy link
Contributor

@ankur-arch ankur-arch commented Dec 3, 2025

Summary by CodeRabbit

  • Documentation
    • Updated read-replicas guide to show the new adapter-based initialization approach and multi-replica setup.
    • Clarified behavior: reads route to replicas; writes and transactions go to primary.
    • Added Prisma 7 compatibility notes and explicit Prisma v6 migration guidance.
    • Refreshed installation and usage instructions with updated examples illustrating adapter-backed clients.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2025

Walkthrough

Documentation for Prisma read replicas was updated to use adapter-based PrismaClient initialization (e.g., new PrismaClient({ adapter })) with PrismaPg adapters, added Prisma 7+ compatibility notes, Prisma v6 fallback guidance, and expanded examples for multiple replica clients and query routing.

Changes

Cohort / File(s) Summary
Read replicas — adapter migration & docs
content/200-orm/200-prisma-client/000-setup-and-configuration/200-read-replicas.mdx
Rewrote examples and instructions to require full PrismaClient instances wired via adapters (e.g., PrismaPg) instead of URL-based replicas or $extends(). Updated install snippets to use @latest, added Prisma 7+ compatibility notes and explicit Prisma v6 fallback guidance. Added driver-adapter initialization examples, multi-replica array examples, and clarified read/write/transaction routing behavior. Updated public-API usage examples to show new PrismaClient({ adapter }) and new PrismaPg({ connectionString }).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Single documentation file but contains multiple API-pattern changes and version-specific code paths.
  • Review focus:
    • Verify PrismaPg constructor signature and PrismaClient({ adapter }) usage match current SDK behavior.
    • Confirm examples for multiple replicas correctly instantiate and wire replica clients.
    • Check versioned notes (Prisma v6 vs v7+) for accuracy and clarity.

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: update read replica docs' directly aligns with the changeset, which comprehensively updates read replica documentation for Prisma 7 compatibility with new examples and configuration patterns.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Dangerous URL check

No absolute URLs to prisma.io/docs found.
No local URLs found.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Redirect check

This PR probably requires the following redirects to be added to static/_redirects:

  • This PR does not change any pages in a way that would require a redirect.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 3, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 3, 2025

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7863c7f
Status:🚫  Build failed.

View logs

Copy link
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: 0

🧹 Nitpick comments (1)
content/200-orm/200-prisma-client/000-setup-and-configuration/200-read-replicas.mdx (1)

64-93: Minor: Harmonize import paths for consistency.

The v6 fallback section is well-documented and clearly separated, but uses a different import path pattern: '../prisma/generated/client' (line 75) vs. './generated/prisma/client' in the main example (line 34) and multiple replicas example (line 106). While both paths are valid for different project structures, using consistent paths across all examples in the same documentation page will reduce user confusion when copy-pasting code.

Consider standardizing on './generated/prisma/client' (used in both the main and multiple replicas examples) for consistency within this documentation.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 307c568 and 7863c7f.

📒 Files selected for processing (1)
  • content/200-orm/200-prisma-client/000-setup-and-configuration/200-read-replicas.mdx (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7301
File: content/800-guides/410-cloudflare-workers.mdx:87-107
Timestamp: 2025-11-20T21:00:02.587Z
Learning: Do not suggest changes to `prisma.config.ts` files in the prisma/docs repository, as the code examples are intentional for documentation purposes.
📚 Learning: 2025-11-20T21:00:02.587Z
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7301
File: content/800-guides/410-cloudflare-workers.mdx:87-107
Timestamp: 2025-11-20T21:00:02.587Z
Learning: Do not suggest changes to `prisma.config.ts` files in the prisma/docs repository, as the code examples are intentional for documentation purposes.

Applied to files:

  • content/200-orm/200-prisma-client/000-setup-and-configuration/200-read-replicas.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Check internal links
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (4)
content/200-orm/200-prisma-client/000-setup-and-configuration/200-read-replicas.mdx (4)

1-27: ✓ Excellent compatibility documentation.

The introduction and setup section now clearly communicate the Prisma 7 requirement and adapter-based API, with helpful guidance directing Prisma v6 users to the fallback section. The compatibility note (lines 21–27) explains the architectural change well.


31-62: ✓ Adapter-based pattern correctly implemented.

The main example now properly demonstrates the Prisma 7 approach: creating adapters, instantiating clients with them, and extending the main client with the readReplicas extension. The code correctly passes full PrismaClient instances rather than URLs, addressing the concern raised in prior review feedback.


99-131: ✓ Multiple replicas example is clear and consistent.

The section correctly extends the single-replica pattern to demonstrate multiple database replicas. The pattern of creating adapters, instantiating clients, and passing them as an array to readReplicas is consistent with the main example and properly documented. The explanation that replicas are randomly selected (line 133) is helpful context.


135-148: ✓ Helper methods well-documented.

The $primary() and $replica() methods are clearly documented with concise, purpose-driven examples that show when and how to override the default query routing.

@ankur-arch ankur-arch merged commit 736ca66 into main Dec 3, 2025
6 of 8 checks passed
@ankur-arch ankur-arch deleted the DC-6404-read-replicas-update branch December 3, 2025 10:52
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