Skip to content

Commit f069fa0

Browse files
authored
docs: Add usage instructions for Prisma ORM without Rust engines with Accelerate and Postgres (#7137)
1 parent 12d19c5 commit f069fa0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

content/200-orm/200-prisma-client/000-setup-and-configuration/300-no-rust-engine.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,42 @@ const prisma = new PrismaClient({ adapter })
214214

215215
If you went through the previous steps, you can query your database as you're used to with Prisma Client. No other changes are needed.
216216

217+
## Usage with Prisma Accelerate or Prisma Postgres
218+
219+
When using the Rust-free version of Prisma ORM with [Prisma Accelerate](/accelerate) or [Prisma Postgres](/postgres), you **should not** use driver adapters. Instead, you can directly instantiate Prisma Client with the appropriate extension.
220+
221+
### 1. Set `engineType` on the `generator` block
222+
223+
```prisma file=schema.prisma
224+
generator client {
225+
provider = "prisma-client" // or `prisma-client-js`
226+
output = "../generated/prisma"
227+
engineType = "client" // enable Prisma ORM without Rust
228+
}
229+
```
230+
231+
### 2. Re-generate Prisma Client
232+
233+
To make the configuration take effect, you need re-generate Prisma Client:
234+
235+
```terminal
236+
npx prisma generate
237+
```
238+
239+
### 3. Instantiate Prisma Client with Accelerate
240+
241+
Import and instantiate Prisma Client with the Accelerate extension:
242+
243+
```typescript
244+
import { PrismaClient } from "./generated/prisma";
245+
import { withAccelerate } from "@prisma/extension-accelerate";
246+
247+
const prisma = new PrismaClient().$extends(withAccelerate());
248+
```
249+
### 4. Query your database
250+
251+
If you went through the previous steps, you can query your database as you're used to with Prisma Client. No other changes are needed.
252+
217253
## Usage with older versions (Preview)
218254

219255
The Rust-free version of Prisma ORM has been in Preview from versions v6.7.0 to v.6.14.0. Expand below if you're using any of these versions and are unable to upgrade to the latest one.

0 commit comments

Comments
 (0)