Skip to content

Commit 2619584

Browse files
authored
docs(config): add missing datasource reference (#7206)
* docs(config): add missing datasource reference * update based on feedback
1 parent 4afe5e1 commit 2619584

File tree

1 file changed

+36
-21
lines changed

1 file changed

+36
-21
lines changed

content/200-orm/500-reference/325-prisma-config-reference.mdx

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ export declare type PrismaConfig = {
101101
// Depending on the choice, you must provide either a `datasource` object or driver adapter
102102
engine: 'classic' | 'js'
103103

104+
// If using the classic engine, datasource sets the database url, shadowDatabaseUrl, or directURL
105+
datasource?: {
106+
url: string;
107+
directUrl?: string;
108+
shadowDatabaseUrl?: string;
109+
}
110+
104111
};
105112
```
106113

@@ -363,29 +370,37 @@ export default defineConfig({
363370
});
364371
```
365372

366-
Alternatively, if you are opting to use the newer Rust-free schema engine, set the engine to `js` and
367-
provide the adapter you wish to use
373+
### `datasource.url`
374+
375+
Connection URL including authentication info. Most connectors use [the syntax provided by the database](/orm/reference/connection-urls#format).
376+
377+
| Property | Type | Required | Default |
378+
| -------- | ------------------ | -------- | ----------------- |
379+
| `datasource.url` | `string` | Yes | `''` |
380+
381+
382+
### `datasource.shadowDatabaseUrl`
383+
384+
385+
Connection URL to the shadow database used by Prisma Migrate. Allows you to use a cloud-hosted database as the shadow database
386+
387+
| Property | Type | Required | Default |
388+
| -------- | ------------------ | -------- | ----------------- |
389+
| `datasource.shadowDatabaseUrl` | `string` | No | `''` |
390+
391+
392+
### `datasource.directUrl`
393+
394+
395+
Connection URL for direct connection to the database.
396+
397+
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. <br/> <br/> The `directUrl` property is supported by Prisma Studio from version 5.1.0 upwards. <br/> <br/> The `directUrl` property is not needed when using [Prisma Postgres](/postgres) database.
398+
399+
| Property | Type | Required | Default |
400+
| -------- | ------------------ | -------- | ----------------- |
401+
| `datasource.directUrl` | `string` | No | `''` |
368402

369-
```ts
370-
import path from "node:path";
371-
import { defineConfig, env } from "prisma/config";
372-
import { PrismaD1 } from "@prisma/adapter-d1";
373-
export default defineConfig({
374-
experimental: {
375-
adapter: true
376-
},
377-
engine: "js",
378-
async adapter() {
379-
return new PrismaD1({
380-
CLOUDFLARE_D1_TOKEN: process.env.CLOUDFLARE_D1_TOKEN,
381-
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID,
382-
CLOUDFLARE_DATABASE_ID: process.env.CLOUDFLARE_DATABASE_ID,
383-
});
384-
},
385-
schema: path.join("prisma", "schema.prisma"),
386-
});
387403

388-
```
389404

390405

391406
## Common patterns

0 commit comments

Comments
 (0)