Skip to content

docs(docs): align quickstart prisma.config.ts with actual prisma init output#7927

Open
morgan-coded wants to merge 1 commit into
prisma:mainfrom
morgan-coded:docs/7818-align-prisma-config-output
Open

docs(docs): align quickstart prisma.config.ts with actual prisma init output#7927
morgan-coded wants to merge 1 commit into
prisma:mainfrom
morgan-coded:docs/7818-align-prisma-config-output

Conversation

@morgan-coded
Copy link
Copy Markdown

@morgan-coded morgan-coded commented May 29, 2026

What

The quickstart guides show the generated prisma.config.ts as:

import "dotenv/config";
import { defineConfig, env } from "prisma/config";
...
  datasource: { url: env("DATABASE_URL") }

But prisma init (standard npm/pnpm/yarn, i.e. the non-Bun runtime) actually
generates:

import "dotenv/config";
import { defineConfig } from "prisma/config";
...
  datasource: { url: process.env["DATABASE_URL"] }

The env() import/accessor is only emitted on the Bun runtime branch. In
packages/cli/src/Init.ts, defaultConfig picks the template with
runtime: isBun ? 'bun' : 'other', and the 'other' branch uses
import { defineConfig } + process.env["DATABASE_URL"]. The datasource
provider and --db flag don't change this. So the docs were incorrect for the
standard flow every quickstart describes (they all install via npm + dotenv).

Reported in #7818.

Change

Update the prisma.config.ts example to match the actual non-Bun output on the
7 single-block quickstarts: postgresql, prisma-postgres, mysql, sqlite,
sql-server, cockroachdb, planetscale.

mongodb is intentionally left out — it presents a different two-step
"generated, then add dotenv" narrative with engine: "classic", and should be
reviewed separately.

Testing

  • pnpm run lint:spellcheck — passes.
  • Verified the replacement against prisma/prisma packages/cli/src/Init.ts
    (defaultConfig, runtime: 'other' branch).

Closes #7818

Summary by CodeRabbit

  • Documentation
    • Updated Prisma quickstart guides with revised configuration examples across all supported database platforms to provide clearer guidance on initializing database connections and configuring environment variables.

Review Change Stack

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>
Copilot AI review requested due to automatic review settings May 29, 2026 15:16
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@morgan-coded is attempting to deploy a commit to the Prisma Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 env import from prisma/config in multiple quickstart guides.
  • Replace env("DATABASE_URL") with process.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:

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 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: db5e2dc9-df94-4160-a26f-2b189dd02917

📥 Commits

Reviewing files that changed from the base of the PR and between ffe9059 and 879940a.

📒 Files selected for processing (7)
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/cockroachdb.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/mysql.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/planetscale.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/postgresql.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/prisma-postgres.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/sql-server.mdx
  • apps/docs/content/docs/(index)/prisma-orm/quickstart/sqlite.mdx

Walkthrough

This PR updates documentation quickstart guides for seven database providers to align their example prisma.config.ts code blocks with the actual output generated by the prisma init command. The change removes the env helper import and replaces env("DATABASE_URL") with direct process.env["DATABASE_URL"] access.

Changes

Database Quickstart Config Examples

Layer / File(s) Summary
Update quickstart config examples across all database providers
apps/docs/content/docs/(index)/prisma-orm/quickstart/cockroachdb.mdx, mysql.mdx, planetscale.mdx, postgresql.mdx, prisma-postgres.mdx, sql-server.mdx, sqlite.mdx
Each database-specific quickstart updates its prisma.config.ts code example to remove the env import and use process.env["DATABASE_URL"] instead of env("DATABASE_URL") for datasource configuration, aligning the documented examples with the actual prisma init output.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related issues

  • #7818: `prisma init ...` command generates different output than what is shown in the docs — This PR directly addresses the reported mismatch by updating all quickstart documentation examples to reflect what prisma init currently generates (process.env["DATABASE_URL"] instead of env("DATABASE_URL")).
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: aligning the quickstart documentation examples with the actual prisma init output.
Linked Issues check ✅ Passed The PR fully addresses issue #7818 by updating all seven quickstart guides to reflect the actual prisma init output using process.env instead of the env helper.
Out of Scope Changes check ✅ Passed All changes are scoped to documentation updates for the prisma.config.ts examples in quickstart guides, directly addressing the linked issue requirements.
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.

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

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.

prisma init ... command generates different output, than what is shown in the docs

2 participants