Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ model User {
If you are using a traditional PostgreSQL database that's accessed via TCP and the `pg` driver, you need to:

- use the `@prisma/adapter-pg` database adapter (learn more [here](/orm/core-concepts/supported-databases/postgresql#using-driver-adapters))
- set `node_compat = true` in `wrangler.toml` (see the [Cloudflare docs](https://developers.cloudflare.com/workers/runtime-apis/nodejs/))
- set `nodejs_compat` in `wrangler.jsonc` (see the [Cloudflare docs](https://developers.cloudflare.com/workers/runtime-apis/nodejs/))

#### 1. Configure Prisma schema & database connection

Expand Down Expand Up @@ -255,20 +255,19 @@ Next, install the required packages:
npm install @prisma/adapter-pg
```

#### 3. Set `node_compat = true` in `wrangler.toml`
#### 3. Set `nodejs_compat` in `wrangler.jsonc`

In your `wrangler.toml` file, add the following line:
In your `wrangler.jsonc` file, add the following lines:

```toml title="wrangler.toml"
node_compat = true
```json title="wrangler.jsonc"
{
"compatibility_flags": [
"nodejs_compat"
],
"compatibility_date": "2026-08-23"
}
```

:::note

For Cloudflare Pages, using `node_compat` is not officially supported. If you want to use `pg` in Cloudflare Pages, you can find a workaround [here](https://github.com/cloudflare/workers-sdk/pull/2541#issuecomment-1954209855).

:::

#### 4. Migrate your database schema (if applicable)

If you ran `npx prisma init` above, you need to migrate your database schema to create the `User` table that's defined in your Prisma schema (if you already have all the tables you need in your database, you can skip this step):
Expand Down