-
Notifications
You must be signed in to change notification settings - Fork 855
Update docs to perform migrations with connection pooling and Prisma config #7266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update docs to perform migrations with connection pooling and Prisma config #7266
Conversation
WalkthroughDocumentation updates shift database connection guidance across eight pages to introduce a dual-URL architecture: prisma.config.ts handles CLI operations with DIRECT_URL, while Prisma Client runtime uses pooled DATABASE_URL via driver adapters. Changes affect Supabase, Neon, PgBouncer, Vercel, Accelerate guides and connection configuration references. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Pre-merge checks✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Dangerous URL checkNo absolute URLs to prisma.io/docs found. |
Redirect checkThis PR probably requires the following redirects to be added to static/_redirects:
|
There was a problem hiding this 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 (4)
content/300-accelerate/200-getting-started.mdx (1)
44-55: Dual-URL flow looks good; add minimum version note.Consider adding: “Prisma CLI reads prisma.config.ts in 6.12.0+.” For older versions, mention the schema datasource URL behavior.
content/200-orm/200-prisma-client/500-deployment/301-edge/485-deploy-to-vercel.mdx (1)
1-8: Title casing consistency (optional).Docs use sentence case for headings/titles. Consider “Deploy to Vercel Edge Functions and middleware” to align, unless you’re preserving product-cased names.
As per coding guidelines.
content/200-orm/050-overview/500-databases/880-supabase.mdx (1)
44-78: Clarify DIRECT_URL recommendation (avoid session pooler).For CLI, prefer the true direct DB host (
db.[project-ref].supabase.co:5432). The session pooler (pooler.supabase.com:5432) is still pooled and can reintroduce pooling caveats during Migrate/Introspection. Suggest keeping only the direct host as the recommendedDIRECT_URL.content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/index.mdx (1)
339-371: Great summary of the dual-URL approach.Consider adding a small note that
prisma.config.tsis supported from Prisma 6.12.0+ to set expectations for older projects.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
content/200-orm/050-overview/500-databases/880-supabase.mdx(2 hunks)content/200-orm/050-overview/500-databases/890-neon.mdx(1 hunks)content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/200-pgbouncer.mdx(1 hunks)content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/index.mdx(1 hunks)content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx(3 hunks)content/200-orm/200-prisma-client/150-using-raw-sql/100-typedsql.mdx(1 hunks)content/200-orm/200-prisma-client/500-deployment/301-edge/485-deploy-to-vercel.mdx(2 hunks)content/200-orm/500-reference/050-prisma-client-reference.mdx(1 hunks)content/300-accelerate/200-getting-started.mdx(5 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: ankur-arch
Repo: prisma/docs PR: 7066
File: content/200-orm/200-prisma-client/700-debugging-and-troubleshooting/245-troubleshooting-binary-size-issues.mdx:8-22
Timestamp: 2025-08-11T09:40:55.237Z
Learning: When the queryCompiler preview feature is enabled in Prisma ORM (v6.7.0+), it does not require Rust engines for CLI tools like `prisma migrate` or `prisma db pull`. The previous understanding that CLI tools would still need Rust binaries even with queryCompiler enabled is incorrect.
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7167
File: content/900-ai/prompts/astro.mdx:84-84
Timestamp: 2025-10-09T21:32:50.340Z
Learning: The `npx prisma init` command supports the following flags: `--db` (shorthand for `--datasource-provider prisma+postgres`), `--output` (specifies output location for generated client), `--generator-provider` (defines the generator provider), `--datasource-provider`, `--url`, `--preview-feature`, and `--with-model`. These are documented valid CLI options for Prisma init command.
📚 Learning: 2025-10-08T16:23:00.388Z
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7165
File: content/800-guides/550-test-guide.mdx:85-90
Timestamp: 2025-10-08T16:23:00.388Z
Learning: For .mdx files in the prisma/docs repository: All headings and titles should use sentence case (e.g., "Getting started with Prisma ORM", "Best practices for authentication"), not title case. Exception: Always preserve exact casing for product names including "Prisma Postgres", "Prisma", "Prisma ORM", and "Prisma Data Platform".
Applied to files:
content/200-orm/500-reference/050-prisma-client-reference.mdxcontent/200-orm/200-prisma-client/150-using-raw-sql/100-typedsql.mdxcontent/200-orm/050-overview/500-databases/880-supabase.mdx
📚 Learning: 2025-10-08T16:23:00.388Z
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7165
File: content/800-guides/550-test-guide.mdx:85-90
Timestamp: 2025-10-08T16:23:00.388Z
Learning: For .mdx files in the prisma/docs repository: Only flag code snippets for (1) exposed secrets with real-looking values that should be placeholders (e.g., API keys, database passwords, AWS credentials), or (2) blatant syntax errors like missing parentheses, brackets, braces, or mismatched delimiters. Do not flag code quality issues, anti-patterns, security vulnerabilities, missing error handling, unused variables, or any other bad practices, as documentation intentionally shows problematic code.
Applied to files:
content/200-orm/500-reference/050-prisma-client-reference.mdxcontent/200-orm/200-prisma-client/150-using-raw-sql/100-typedsql.mdxcontent/200-orm/050-overview/500-databases/880-supabase.mdxcontent/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/index.mdxcontent/200-orm/050-overview/500-databases/890-neon.mdx
📚 Learning: 2025-10-08T16:22:57.129Z
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7165
File: content/800-guides/550-test-guide.mdx:50-66
Timestamp: 2025-10-08T16:22:57.129Z
Learning: In `.mdx` files, do NOT flag or suggest changes for the following code quality issues even if they represent poor practices: React anti-patterns (using var instead of useState, direct DOM manipulation), missing keys in .map() iterations, non-serializable props in getServerSideProps, unused variables, missing error handling, SQL injection vulnerabilities (unless actively showing how to fix them), insecure cookie settings, missing TypeScript types, PrismaClient instantiation patterns, or any other code quality, security, or performance issues. Documentation code snippets are copied from source code and often intentionally show "before" examples or common mistakes.
Applied to files:
content/200-orm/200-prisma-client/150-using-raw-sql/100-typedsql.mdxcontent/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx
📚 Learning: 2025-08-11T09:40:55.237Z
Learnt from: ankur-arch
Repo: prisma/docs PR: 7066
File: content/200-orm/200-prisma-client/700-debugging-and-troubleshooting/245-troubleshooting-binary-size-issues.mdx:8-22
Timestamp: 2025-08-11T09:40:55.237Z
Learning: When the queryCompiler preview feature is enabled in Prisma ORM (v6.7.0+), it does not require Rust engines for CLI tools like `prisma migrate` or `prisma db pull`. The previous understanding that CLI tools would still need Rust binaries even with queryCompiler enabled is incorrect.
Applied to files:
content/200-orm/200-prisma-client/150-using-raw-sql/100-typedsql.mdxcontent/200-orm/050-overview/500-databases/880-supabase.mdxcontent/200-orm/200-prisma-client/500-deployment/301-edge/485-deploy-to-vercel.mdxcontent/300-accelerate/200-getting-started.mdxcontent/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/index.mdxcontent/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/200-pgbouncer.mdx
📚 Learning: 2025-10-09T21:32:50.340Z
Learnt from: aidankmcalister
Repo: prisma/docs PR: 7167
File: content/900-ai/prompts/astro.mdx:84-84
Timestamp: 2025-10-09T21:32:50.340Z
Learning: The `npx prisma init` command supports the following flags: `--db` (shorthand for `--datasource-provider prisma+postgres`), `--output` (specifies output location for generated client), `--generator-provider` (defines the generator provider), `--datasource-provider`, `--url`, `--preview-feature`, and `--with-model`. These are documented valid CLI options for Prisma init command.
Applied to files:
content/200-orm/200-prisma-client/150-using-raw-sql/100-typedsql.mdxcontent/200-orm/050-overview/500-databases/880-supabase.mdxcontent/200-orm/200-prisma-client/500-deployment/301-edge/485-deploy-to-vercel.mdxcontent/300-accelerate/200-getting-started.mdxcontent/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/index.mdxcontent/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/200-pgbouncer.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 (13)
content/200-orm/200-prisma-client/100-queries/037-relation-queries.mdx (3)
533-534: Verify consistency ofcreateManyanchor reference across the document.Line 534 references
#createmany-1, while line 643 (also changed in this PR) references#createmany(without the-1suffix). Both are documenting the same concept (nestedcreateManyoperations). According to the AI summary, anchor references should have been updated uniformly across the section, so this inconsistency may indicate an incomplete refactor.Please verify against the prisma-client-reference documentation whether:
- Both references should point to
#createmany(without-1)- Or whether
#createmany-1is a distinct, intentional anchor for this specific contextIf they should be consistent, apply this diff:
- Use a nested [`createMany`](/orm/reference/prisma-client-reference#createmany-1) query + Use a nested [`createMany`](/orm/reference/prisma-client-reference#createmany) query
547-547: Consistent anchor reference forcreate.The reference to
#createon line 547 is consistent with line 533. No issues detected here.
643-643: Anchor reference updated correctly.Line 643 properly uses
#createmany(without the-1suffix), aligning with the PR's goal to update anchor references uniformly. However, note the inconsistency flagged in the review comment for line 534.content/200-orm/500-reference/050-prisma-client-reference.mdx (1)
826-830: Check anchor target for nested create.The link now points to
#create. Please verify the section ID resolves correctly and update any other in-page links that still reference#create-1.content/200-orm/200-prisma-client/150-using-raw-sql/100-typedsql.mdx (1)
245-249: Gate prisma.config.ts behavior by version.You state the CLI reads
prisma.config.ts. That’s true starting in Prisma 6.12.0. Please add a brief version note (and fallback to datasource URL in schema for older versions) to prevent confusion.content/300-accelerate/200-getting-started.mdx (4)
71-73: Verify prisma+postgres support for Migrate/Introspection.“PostgreSQL has no need for directUrl” relies on CLI compatibility with
prisma+postgres://. Please confirm this is supported in the currently documented versions and call it out explicitly (versions and commands).
133-136: Confirm PrismaClient accelerateUrl option.Is
accelerateUrla supported constructor option for the versions you target, or should the URL be passed viawithAccelerate(...)options andDATABASE_URL? Please verify API shape and adjust the snippet if needed.
144-147: Edge client snippet: same concern about accelerateUrl.As above, please confirm
accelerateUrlon the edge client. If unsupported, update to the recommendedwithAccelerateusage pattern.
158-163: Extension order example: nice.Good callout on precedence and ordering with Optimize before Accelerate.
content/200-orm/200-prisma-client/500-deployment/301-edge/485-deploy-to-vercel.mdx (1)
173-181: CLI uses direct connection on Vercel (POSTGRES_URL_NON_POOLING).This update aligns with the dual-URL guidance. LGTM.
content/200-orm/050-overview/500-databases/890-neon.mdx (1)
49-71: Dual-URL + prisma.config.ts pattern reads well.Clear split between pooled runtime and direct CLI. LGTM.
content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/200-pgbouncer.mdx (1)
68-99: Direct CLI + pooled runtime via adapter is correct for PgBouncer.This workaround accurately avoids prepared-statement issues during Migrate while keeping pooling for app traffic.
content/200-orm/050-overview/500-databases/880-supabase.mdx (1)
29-34: Runtime pooled URL guidance looks good.Using
?pgbouncer=truewith Supavisor for the app runtime via adapter is consistent with the overall pattern.
| At runtime, instantiate Prisma Client with the pooled connection string using `@prisma/adapter-neon`: | ||
|
|
||
| ```ts file=src/db/client.ts showLineNumbers | ||
| import { PrismaClient } from '../prisma/generated/client' | ||
| import { PrismaNeon } from '@prisma/adapter-neon' | ||
|
|
||
| const adapter = new PrismaNeon({ connectionString: process.env.DATABASE_URL }) | ||
| export const prisma = new PrismaClient({ adapter }) | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep wording consistent with prisma.config.ts.
Later, the Neon driver section states Migrate/Introspection/Studio “use the connection string defined in the Prisma schema.” With this PR we standardize on prisma.config.ts for CLI tools. Please update that sentence for consistency (and add a version note if needed).
🤖 Prompt for AI Agents
In content/200-orm/050-overview/500-databases/890-neon.mdx around lines 73 to
81, the wording refers to using the connection string defined in the Prisma
schema for Migrate/Introspection/Studio but our repo now standardizes on
prisma.config.ts for CLI tools; update the sentence to say these tools use the
connection string defined in prisma.config.ts (and add a brief version note if
this change is relevant to a specific Prisma/adapter release), ensuring wording
matches prisma.config.ts used earlier in the file.
…s-with-connection-pooling
🍈 Lychee Link Check Report
📊 Results Overview
|
Summary by CodeRabbit