Skip to content

docs: update PrismaClient initialization for v7 mandatory driver adapters#7804

Open
DaveAdbeel wants to merge 3 commits intoprisma:mainfrom
DaveAdbeel:patch-1
Open

docs: update PrismaClient initialization for v7 mandatory driver adapters#7804
DaveAdbeel wants to merge 3 commits intoprisma:mainfrom
DaveAdbeel:patch-1

Conversation

@DaveAdbeel
Copy link
Copy Markdown

@DaveAdbeel DaveAdbeel commented Apr 20, 2026

Updating PrismaClient initialization documentation to reflect mandatory driver adapters for the v7 release.

Summary by CodeRabbit

  • Documentation
    • Clarified Prisma Client setup: explicitly configure a database driver adapter when connecting directly to a database.
    • Added a "Prisma 7 Connection Requirements" callout explaining driver adapter needs, how to use Prisma Accelerate with accelerateUrl + extension, and the requirement to enable ESM ("type": "module").
    • Included links to supported adapter docs and the V7 upgrade guide.

Updated PrismaClient initialization to include adapter support and added Prisma 7 connection requirements.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 20, 2026

@DaveAdbeel is attempting to deploy a commit to the Prisma Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 64914f11-e60a-41cd-a66a-20ea9bd73d0c

📥 Commits

Reviewing files that changed from the base of the PR and between 39538fd and 30f0ef3.

📒 Files selected for processing (1)
  • apps/docs/content/docs/orm/index.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/docs/content/docs/orm/index.mdx

Walkthrough

Prisma Client docs updated to show importing and instantiating a database driver adapter (e.g., PrismaPg), passing { adapter } into new PrismaClient(...), and adding a "Prisma 7 Connection Requirements" callout covering driver adapters for direct DB connections, Prisma Accelerate usage, and ESM "type": "module".

Changes

Cohort / File(s) Summary
Documentation: Prisma ORM guide
apps/docs/content/docs/orm/index.mdx
Replaced zero-arg PrismaClient() example with adapter-based initialization (PrismaPg import, construct adapter from process.env.DATABASE_URL, new PrismaClient({ adapter })). Added "Prisma 7 Connection Requirements" callout: driver adapters required for direct DB connections, use accelerateUrl + Accelerate extension for Prisma Accelerate, ESM must be enabled via "type": "module", and links to supported adapters and V7 upgrade guide.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • PostgreSQL - instantiation of Prisma Client #7464 — Related: that issue notes PrismaPg expects a pg.Pool or PoolConfig and shows instantiation like new PrismaPg(new Pool({ connectionString })); this PR's adapter-instantiation example may need to align with that expected pattern.
🚥 Pre-merge checks | ✅ 3
✅ 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 accurately describes the main change: updating PrismaClient initialization documentation to reflect v7's mandatory driver adapter requirement.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

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

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

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 | 🟠 Major

Make 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 generate
import { 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9bcb676 and 7f9d9a6.

📒 Files selected for processing (1)
  • apps/docs/content/docs/orm/index.mdx

Comment thread apps/docs/content/docs/orm/index.mdx Outdated
Adding suggestions from coderabbitai, resolving the minor issue.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7f9d9a6 and 39538fd.

📒 Files selected for processing (1)
  • apps/docs/content/docs/orm/index.mdx

Comment thread apps/docs/content/docs/orm/index.mdx Outdated
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.

1 participant