docs: update PrismaClient initialization for v7 mandatory driver adapters#7804
docs: update PrismaClient initialization for v7 mandatory driver adapters#7804DaveAdbeel wants to merge 3 commits intoprisma:mainfrom
Conversation
Updated PrismaClient initialization to include adapter support and added Prisma 7 connection requirements.
|
@DaveAdbeel is attempting to deploy a commit to the Prisma Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughPrisma Client docs updated to show importing and instantiating a database driver adapter (e.g., Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/docs/content/docs/orm/index.mdx (1)
111-125:⚠️ Potential issue | 🟠 MajorMake the Prisma 7 adapter example functional and correct.
This page's schema uses PostgreSQL, but the updated code example imports a non-existent placeholder adapter (
@prisma/adapter-xyz) and the install command is incomplete—readers won't have the adapter or database driver (pg) needed to run it. Additionally, line 147-149 incorrectly references@prisma/adapter-mysql, which doesn't exist in the npm registry; the correct package for MySQL/MariaDB is@prisma/adapter-mariadb.The fix is straightforward: use concrete imports and package names that match the schema (PostgreSQL example with
PrismaPg), complete the install command with the adapter and driver, and update the MySQL reference to@prisma/adapter-mariadb.Proposed fix
```npm -npm install `@prisma/client` +npm install `@prisma/client` `@prisma/adapter-pg` pg npx prisma generateimport { PrismaClient } from "./generated/client"; // Import the driver adapter for your specific database -import { PrismaAdapter } from "@prisma/adapter-xyz"; +import { PrismaPg } from "@prisma/adapter-pg"; // Initialize the adapter according to your driver's requirements -const adapter = new PrismaAdapter(...); +const adapter = new PrismaPg({ + connectionString: process.env.DATABASE_URL!, +}); // Pass the adapter instance to PrismaClient const prisma = new PrismaClient({ adapter });-* **Install an adapter:** Use the specific package for your database (e.g., `@prisma/adapter-pg`, `@prisma/adapter-mysql`, etc.). +* **Install an adapter:** Use the specific package for your database (e.g., `@prisma/adapter-pg`, `@prisma/adapter-mariadb`, etc.).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/docs/content/docs/orm/index.mdx` around lines 111 - 125, Update the example to use the real PostgreSQL adapter and include required packages: change the install command to add the adapter and driver (e.g., npm install `@prisma/client` `@prisma/adapter-pg` pg and then npx prisma generate), replace the placeholder import of "@prisma/adapter-xyz" with the concrete PrismaPg import from "@prisma/adapter-pg", initialize the adapter with a connection string (e.g., new PrismaPg({ connectionString: process.env.DATABASE_URL! })) and pass that adapter into PrismaClient (PrismaClient({ adapter })); also correct the MySQL reference to use "@prisma/adapter-mariadb" where applicable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/docs/content/docs/orm/index.mdx`:
- Around line 145-151: The wording that "providing a driver adapter is
mandatory" is misleading for Prisma Accelerate users; update the paragraph
around "Starting with Prisma 7" to explicitly state the exception: note that
driver adapters are required for normal database connections (mention examples
like `@prisma/adapter-pg` / enabling ESM and link to the V7 Upgrade Guide) but
when using Prisma Accelerate you should use `accelerateUrl` together with the
`withAccelerate()` extension instead of wiring `prisma://`/`prisma+postgres://`
into a driver adapter; ensure you reference `accelerateUrl` and
`withAccelerate()` by name and add a short sentence warning that attempting to
use Accelerate URLs with a driver adapter will fail.
---
Outside diff comments:
In `@apps/docs/content/docs/orm/index.mdx`:
- Around line 111-125: Update the example to use the real PostgreSQL adapter and
include required packages: change the install command to add the adapter and
driver (e.g., npm install `@prisma/client` `@prisma/adapter-pg` pg and then npx
prisma generate), replace the placeholder import of "@prisma/adapter-xyz" with
the concrete PrismaPg import from "@prisma/adapter-pg", initialize the adapter
with a connection string (e.g., new PrismaPg({ connectionString:
process.env.DATABASE_URL! })) and pass that adapter into PrismaClient
(PrismaClient({ adapter })); also correct the MySQL reference to use
"@prisma/adapter-mariadb" where applicable.
🪄 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: 9d25d6e5-d553-4a90-a3d3-b31dcc1483c0
📒 Files selected for processing (1)
apps/docs/content/docs/orm/index.mdx
Adding suggestions from coderabbitai, resolving the minor issue. Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/docs/content/docs/orm/index.mdx`:
- Around line 118-125: Replace the fake adapter example (PrismaAdapter from
`@prisma/adapter-xyz` and the invalid new PrismaAdapter(...)) with a concrete,
copy‑pasteable snippet that matches the canonical shape used elsewhere: import
PrismaPg from `@prisma/adapter-pg`, construct it with a { connectionString }
option, and pass that adapter instance into PrismaClient; update references from
PrismaAdapter to PrismaPg and replace the invalid "..." constructor argument
with an explicit { connectionString } placeholder and a short comment pointing
to the supported driver adapters list.
🪄 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: ba4939c5-baca-42c8-a4a0-3a73c4dc32be
📒 Files selected for processing (1)
apps/docs/content/docs/orm/index.mdx
Updating PrismaClient initialization documentation to reflect mandatory driver adapters for the v7 release.
Summary by CodeRabbit
"type": "module").