From 6268a72e48acbd493d9bf0b5940311d7300612f0 Mon Sep 17 00:00:00 2001 From: Mike Hartington Date: Wed, 22 Oct 2025 12:12:21 -0400 Subject: [PATCH 1/2] docs(config): add missing datasource reference --- .../325-prisma-config-reference.mdx | 57 ++++++++++++------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/content/200-orm/500-reference/325-prisma-config-reference.mdx b/content/200-orm/500-reference/325-prisma-config-reference.mdx index 611dcc7c2b..37b3aad01c 100644 --- a/content/200-orm/500-reference/325-prisma-config-reference.mdx +++ b/content/200-orm/500-reference/325-prisma-config-reference.mdx @@ -101,6 +101,13 @@ export declare type PrismaConfig = { // Depending on the choice, you must provide either a `datasource` object or driver adapter engine: 'classic' | 'js' + // If using the clasic engine, datasource sets the database url, shadowDatabaseUrl, or directURL + datasource: { + url: string; + directUrl?: string; + shadowDatabaseUrl?: string; + } + }; ``` @@ -363,29 +370,37 @@ export default defineConfig({ }); ``` -Alternatively, if you are opting to use the newer Rust-free schema engine, set the engine to `js` and -provide the adapter you wish to use +### `datasource.url` + +Connection URL including authentication info. Most connectors use [the syntax provided by the database](/orm/reference/connection-urls#format). + +| Property | Type | Required | Default | +| -------- | ------------------ | -------- | ----------------- | +| `datasource.url` | `string` | Yes | `''` | + + +### `datasource.shadowDatabaseUrl` + + +Connection URL to the shadow database used by Prisma Migrate. Allows you to use a cloud-hosted database as the shadow database + +| Property | Type | Required | Default | +| -------- | ------------------ | -------- | ----------------- | +| `datasource.shadowDatabaseUrl` | `string` | No | `''` | + + +### `datasource.directUrL` + + +Connection URL for direct connection to the database. + +If you use a connection pooler URL in the `url` argument (for example, if you use [Prisma Accelerate](/accelerate) or pgBouncer), Prisma CLI commands that require a direct connection to the database use the URL in the `directUrl` argument.

The `directUrl` property is supported by Prisma Studio from version 5.1.0 upwards.

The `directUrl` property is not needed when using [Prisma Postgres](/postgres) database. + +| Property | Type | Required | Default | +| -------- | ------------------ | -------- | ----------------- | +| `datasource.directUrl` | `string` | No | `''` | -```ts -import path from "node:path"; -import { defineConfig, env } from "prisma/config"; -import { PrismaD1 } from "@prisma/adapter-d1"; -export default defineConfig({ - experimental: { - adapter: true - }, - engine: "js", - async adapter() { - return new PrismaD1({ - CLOUDFLARE_D1_TOKEN: process.env.CLOUDFLARE_D1_TOKEN, - CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID, - CLOUDFLARE_DATABASE_ID: process.env.CLOUDFLARE_DATABASE_ID, - }); - }, - schema: path.join("prisma", "schema.prisma"), -}); -``` ## Common patterns From 7d6dbc80a15eeffc66f5cdaac7b3dbf8f9cc3afc Mon Sep 17 00:00:00 2001 From: Mike Hartington Date: Wed, 22 Oct 2025 12:17:51 -0400 Subject: [PATCH 2/2] update based on feedback --- .../200-orm/500-reference/325-prisma-config-reference.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/200-orm/500-reference/325-prisma-config-reference.mdx b/content/200-orm/500-reference/325-prisma-config-reference.mdx index 37b3aad01c..2ecf7bfdaf 100644 --- a/content/200-orm/500-reference/325-prisma-config-reference.mdx +++ b/content/200-orm/500-reference/325-prisma-config-reference.mdx @@ -101,8 +101,8 @@ export declare type PrismaConfig = { // Depending on the choice, you must provide either a `datasource` object or driver adapter engine: 'classic' | 'js' - // If using the clasic engine, datasource sets the database url, shadowDatabaseUrl, or directURL - datasource: { + // If using the classic engine, datasource sets the database url, shadowDatabaseUrl, or directURL + datasource?: { url: string; directUrl?: string; shadowDatabaseUrl?: string; @@ -389,7 +389,7 @@ Connection URL to the shadow database used by Prisma Migrate. Allows you to use | `datasource.shadowDatabaseUrl` | `string` | No | `''` | -### `datasource.directUrL` +### `datasource.directUrl` Connection URL for direct connection to the database.