docs(docs): align quickstart prisma.config.ts with actual prisma init output#7927
docs(docs): align quickstart prisma.config.ts with actual prisma init output#7927morgan-coded wants to merge 1 commit into
Conversation
The quickstarts show the generated prisma.config.ts importing env from
prisma/config and using env("DATABASE_URL"), but prisma init (non-Bun runtime)
actually emits import { defineConfig } and url: process.env["DATABASE_URL"]
(see packages/cli/src/Init.ts defaultConfig, the runtime: "other" branch). The
runtime is bun only when the CLI itself runs under Bun, so every standard
npm/pnpm/yarn init produces the process.env form. Update the 7 single-block
quickstarts to match. mongodb is intentionally left out: it presents a
different two-step (generated then add dotenv) narrative with engine: "classic"
and needs a separate review.
Linear: N/A (external community contribution)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@morgan-coded is attempting to deploy a commit to the Prisma Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates Prisma ORM quickstart docs to use process.env for DATABASE_URL in prisma.config.ts examples instead of Prisma’s env() helper.
Changes:
- Remove
envimport fromprisma/configin multiple quickstart guides. - Replace
env("DATABASE_URL")withprocess.env["DATABASE_URL"]in datasource configuration examples.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/docs/content/docs/(index)/prisma-orm/quickstart/sqlite.mdx | Adjusts prisma.config.ts snippet to read DATABASE_URL from process.env. |
| apps/docs/content/docs/(index)/prisma-orm/quickstart/sql-server.mdx | Same env-var retrieval change in the SQL Server quickstart snippet. |
| apps/docs/content/docs/(index)/prisma-orm/quickstart/prisma-postgres.mdx | Same env-var retrieval change in the Prisma Postgres quickstart snippet. |
| apps/docs/content/docs/(index)/prisma-orm/quickstart/postgresql.mdx | Same env-var retrieval change in the PostgreSQL quickstart snippet. |
| apps/docs/content/docs/(index)/prisma-orm/quickstart/planetscale.mdx | Same env-var retrieval change in the PlanetScale quickstart snippet. |
| apps/docs/content/docs/(index)/prisma-orm/quickstart/mysql.mdx | Same env-var retrieval change in the MySQL quickstart snippet. |
| apps/docs/content/docs/(index)/prisma-orm/quickstart/cockroachdb.mdx | Same env-var retrieval change in the CockroachDB quickstart snippet. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ```typescript title="prisma.config.ts" | ||
| import "dotenv/config"; | ||
| import { defineConfig, env } from "prisma/config"; | ||
| import { defineConfig } from "prisma/config"; |
| }, | ||
| datasource: { | ||
| url: env("DATABASE_URL"), | ||
| url: process.env["DATABASE_URL"], |
| ```typescript title="prisma.config.ts" | ||
| import "dotenv/config"; | ||
| import { defineConfig, env } from "prisma/config"; | ||
| import { defineConfig } from "prisma/config"; |
| }, | ||
| datasource: { | ||
| url: env("DATABASE_URL"), | ||
| url: process.env["DATABASE_URL"], |
| @@ -98,15 +98,15 @@ The generated `prisma.config.ts` file looks like this: | |||
|
|
|||
|
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 (7)
WalkthroughThis PR updates documentation quickstart guides for seven database providers to align their example ChangesDatabase Quickstart Config Examples
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
What
The quickstart guides show the generated
prisma.config.tsas:But
prisma init(standard npm/pnpm/yarn, i.e. the non-Bun runtime) actuallygenerates:
The
env()import/accessor is only emitted on the Bun runtime branch. Inpackages/cli/src/Init.ts,defaultConfigpicks the template withruntime: isBun ? 'bun' : 'other', and the'other'branch usesimport { defineConfig }+process.env["DATABASE_URL"]. The datasourceprovider and
--dbflag don't change this. So the docs were incorrect for thestandard flow every quickstart describes (they all install via npm + dotenv).
Reported in #7818.
Change
Update the
prisma.config.tsexample to match the actual non-Bun output on the7 single-block quickstarts: postgresql, prisma-postgres, mysql, sqlite,
sql-server, cockroachdb, planetscale.
mongodbis intentionally left out — it presents a different two-step"generated, then add dotenv" narrative with
engine: "classic", and should bereviewed separately.
Testing
pnpm run lint:spellcheck— passes.prisma/prismapackages/cli/src/Init.ts(
defaultConfig,runtime: 'other'branch).Closes #7818
Summary by CodeRabbit