Skip to content

Commit 7f8bd61

Browse files
authored
add d1 as supported for queryCompiler (#6945)
* add d1 as supported for queryCompiler * add installation insturction for adapter
1 parent f47ff45 commit 7f8bd61

File tree

9 files changed

+43
-13
lines changed

9 files changed

+43
-13
lines changed

content/200-orm/050-overview/500-databases/200-database-drivers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ One of Prisma Client's components is the [Query Engine](/orm/more/under-the-hood
1414

1515
As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature.
1616

17-
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
17+
**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**:
1818

1919
```prisma
2020
generator client {

content/200-orm/100-prisma-schema/10-overview/03-generators.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ generator client {
4747

4848
As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature.
4949

50-
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
50+
**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**:
5151

5252
```prisma
5353
generator client {

content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/115-connection-pool.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Relational database connectors use Prisma ORM's own connection pool, and the Mon
1616

1717
As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature.
1818

19-
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
19+
**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**:
2020

2121
```prisma
2222
generator client {

content/200-orm/200-prisma-client/000-setup-and-configuration/050-databases-connections/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ If you consistently experience connection pool timeouts after configuring the re
269269

270270
As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature.
271271

272-
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
272+
**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**:
273273

274274
```prisma
275275
generator client {

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

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title: "No Rust engine"
33
metaTitle: "Use Prisma ORM without Rust engines"
44
metaDescription: "Learn how to use Prisma ORM without Rust engines"
5-
sidebar_class_name: early-access-badge
5+
sidebar_class_name: preview-badge
66
---
77

8-
As of [v6.7.0](https://pris.ly/release/6.7.0), you can use Prisma ORM without [Rust engine](/orm/more/under-the-hood/engines) binaries on SQLite or PostgreSQL databases.
8+
As of [v6.7.0](https://pris.ly/release/6.7.0), you can use Prisma ORM without [Rust engine](/orm/more/under-the-hood/engines) binaries on PostgreSQL, SQLite and D1 databases.
99

1010
This page gives an overview of how to use this version of Prisma ORM.
1111

@@ -39,7 +39,7 @@ generator client {
3939

4040
To make the feature flags take effect, you need re-generate Prisma Client:
4141

42-
```
42+
```terminal
4343
npx prisma generate
4444
```
4545

@@ -49,16 +49,22 @@ Depending on the database you use, you need to install a different driver adapte
4949

5050
For **PostgreSQL**:
5151

52-
```
52+
```terminal
5353
npm install @prisma/adapter-pg
5454
```
5555

5656
For **SQLite**:
5757

58-
```
58+
```terminal
5959
npm install @prisma/adapter-better-sqlite3
6060
```
6161

62+
For **D1**:
63+
64+
```terminal
65+
npm install @prisma/adapter-d1
66+
```
67+
6268
### 4. Instantiate Prisma Client
6369

6470
Finally, you need to instantiate Prisma Client which you can do using the driver adapter and the connection URL for the database instance you're using.
@@ -83,6 +89,30 @@ const adapter = new PrismaBetterSQLite3({ url: process.env.DATABASE_URL })
8389
const prisma = new PrismaClient({ adapter });
8490
```
8591

92+
For **D1**:
93+
94+
```ts
95+
import { PrismaClient } from '@prisma/client'
96+
import { PrismaD1 } from '@prisma/adapter-d1'
97+
98+
export interface Env {
99+
DB: D1Database
100+
}
101+
102+
export default {
103+
async fetch(
104+
request: Request,
105+
env: Env,
106+
ctx: ExecutionContext
107+
): Promise<Response> {
108+
const adapter = new PrismaD1(env.DB)
109+
const prisma = new PrismaClient({ adapter })
110+
111+
// ... query your DB
112+
},
113+
}
114+
```
115+
86116
### 5. Query your database
87117

88118
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.

content/200-orm/200-prisma-client/500-deployment/400-module-bundlers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Since Prisma Client is not only based on JavaScript code, but also relies on the
1414

1515
As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature.
1616

17-
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
17+
**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**:
1818

1919
```prisma
2020
generator client {

content/200-orm/200-prisma-client/500-deployment/650-caveats-when-deploying-to-aws-platforms.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ AWS Lambda defines an **deployment package upload limit**, which includes:
6868

6969
As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature.
7070

71-
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
71+
**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**:
7272

7373
```prisma
7474
generator client {

content/200-orm/200-prisma-client/500-deployment/700-deploy-to-a-different-os.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Prisma Client depends on the [query engine](/orm/more/under-the-hood/engines) th
1111

1212
As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature.
1313

14-
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
14+
**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**:
1515

1616
```prisma
1717
generator client {

content/200-orm/800-more/100-under-the-hood/100-engines.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This page covers relevant technical details about the query engine.
1818

1919
As of [v6.7.0](https://pris.ly/release/6.7.0), Prisma ORM has the `queryCompiler` Preview feature.
2020

21-
**When enabled, your Prisma Client will be generated without a Rust-based query engine binary**:
21+
**When enabled, your Prisma Client will be generated [without a Rust-based query engine binary](/orm/prisma-client/setup-and-configuration/no-rust-engine)**:
2222

2323
```prisma
2424
generator client {

0 commit comments

Comments
 (0)