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 0c8ec29c23..611dcc7c2b 100644
--- a/content/200-orm/500-reference/325-prisma-config-reference.mdx
+++ b/content/200-orm/500-reference/325-prisma-config-reference.mdx
@@ -14,18 +14,22 @@ You can define your config in either of two ways:
- Using the `defineConfig` helper:
```ts
import path from "node:path";
- import { defineConfig } from "prisma/config";
+ import { defineConfig, env } from "prisma/config";
export default defineConfig({
schema: path.join("prisma", "schema.prisma"),
- migrations: {
+ migrations: {
path: path.join("db", "migrations"),
},
- views: {
+ views: {
path: path.join("db", "views"),
},
- typedSql: {
- path: path.join("db", "queries"),
+ typedSql: {
+ path: path.join("db", "queries"),
+ },
+ engine: "classic",
+ datasource: {
+ url: env("DATABASE_URL")
}
});
```
@@ -45,6 +49,10 @@ You can define your config in either of two ways:
},
typedSql: {
path: path.join("db", "queries"),
+ },
+ engine: "classic",
+ datasource: {
+ url: env("DATABASE_URL")
}
} satisfies PrismaConfig;
```
@@ -90,6 +98,8 @@ export declare type PrismaConfig = {
typedSql?: {
path: string;
};
+ // Depending on the choice, you must provide either a `datasource` object or driver adapter
+ engine: 'classic' | 'js'
};
```
@@ -131,9 +141,6 @@ import path from "node:path";
import type { PrismaConfig } from "prisma";
import { PrismaD1 } from "@prisma/adapter-d1";
-// import your .env file
-import "dotenv/config";
-
export default {
experimental: {
adapter: true
@@ -332,6 +339,55 @@ Failed to load config file "~" as a TypeScript/JavaScript module. Error: Error:
:::
+
+### `engine`
+
+Configure the schema engine your project should use.
+
+| Property | Type | Required | Default |
+| -------- | ------------------ | -------- | ----------------- |
+| `engine` | `classic` or `js` | No | `classic` |
+
+ By default it is set to use the classic engine, which requires that `datasource` be set
+ in your `prisma.config.ts`.
+
+```ts
+import path from "node:path";
+import { defineConfig, env } from "prisma/config";
+export default defineConfig({
+ engine: "classic",
+ datasource: {
+ url: env('DATABASE_URL'),
+ },
+ schema: path.join("prisma", "schema.prisma"),
+});
+```
+
+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
+
+```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
### Setting up your project
@@ -356,27 +412,37 @@ export default {} satisfies PrismaConfig;
### Using environment variables
-When using `prisma.config.ts`, environment variables from `.env` files are not automatically loaded. If you're using node or deno, you'll need to:
+When using `prisma.config.ts`, environment variables from `.env` files are not automatically loaded. Using `tsx`, you can pass a `--env-file` flag and that will automatically add those values to `process.env`
-1. Pass a `--env-file` flag to the command line
+If using Node or Deno:
-
-
```terminal
-node --env-file=.env index.js
-node --env-file=.env --env-file=.local.env index.js
+tsx --env-file=.env src/index.ts
+tsx watch --env-file=.env --env-file=.local.env src/index.ts
+tsx --env-file=.env ./prisma/seed.ts
```
-
-
-```terminal
-deno run --env-file main.ts
-deno run --env-file=.env --env-file=.local.env main.ts
-```
-
-
For Bun, `.env` files are automatically loaded.
+For accessing environment variables within `prisma.config.ts`, use the `env()` helper function to
+provide a type-safe way of accessing that variable:
+
+```tsx
+import path from "node:path";
+import { defineConfig, env } from "prisma/config";
+
+type Env = {
+ DATABASE_URL: string
+}
+export default defineConfig({
+ engine: "classic",
+ datasource: {
+ url: env('DATABASE_URL'),
+ },
+ schema: path.join("prisma", "schema.prisma"),
+});
+```
+
For releases of Node before v20, you'll need to:
1. Install the `dotenv` package:
@@ -389,11 +455,18 @@ npm install dotenv
```ts
import "dotenv/config";
-import type { PrismaConfig } from "prisma";
+import { defineConfig, env } from "prisma/config";
-export default {
- // now you can use process.env variables
-} satisfies PrismaConfig;
+type Env = {
+ DATABASE_URL: string
+}
+export default defineConfig({
+ engine: "classic",
+ datasource: {
+ url: env('DATABASE_URL'),
+ },
+ schema: path.join("prisma", "schema.prisma"),
+});
```
### Using multi-file schemas
@@ -496,7 +569,7 @@ If Prisma is installed globally (`npm i -g prisma`), it may not find your `prism
To avoid issues:
- Prefer local Prisma installations in your project.
-- Or use `@prisma/config` locally and pass `--config` to point to your config file.
+- Or use `prisma/config` locally and pass `--config` to point to your config file.
### Monorepos
diff --git a/content/250-postgres/100-introduction/250-overview.mdx b/content/250-postgres/100-introduction/250-overview.mdx
index e3d8035024..8b5300dc91 100644
--- a/content/250-postgres/100-introduction/250-overview.mdx
+++ b/content/250-postgres/100-introduction/250-overview.mdx
@@ -27,6 +27,15 @@ You can view the following usage metrics in your Console Dashboard:
- Cumulative operations
- Operations per day
+For details into individual databases in your workspace, each database has it's own metrics report
+as well. You can view the following:
+
+- Average response size
+- Average query duration
+- Total egress
+- Total operations
+- Cache utilization
+
## Billing
### Usage-based pricing
diff --git a/content/500-platform/10-about.mdx b/content/500-platform/10-about.mdx
index a26901a6b7..12208f0cae 100644
--- a/content/500-platform/10-about.mdx
+++ b/content/500-platform/10-about.mdx
@@ -45,6 +45,17 @@ In each workspace, you can:
- invite other users to collaborate in the workspace.
- access the [Optimize dashboard](https://console.prisma.io/optimize?utm_source=docs&utm_medium=optimize-docs) to measure query performance and receive AI-powered recommendations.
+### Database Metrics
+
+You can have a single workspace that hosts several database. Within each database, you can view
+detailed reports on how your database is performing, with various metrics like:
+
+- Average response size
+- Average query duration
+- Total egress
+- Total operations
+- Cache utilization
+
#### Optimize
You can access Optimize within your [Prisma Data Platform account](https://console.prisma.io/optimize) workspace.