Skip to content

Commit 4a29281

Browse files
authored
Merge pull request #495 from saamdotexe/main
docs: Updated Cloudflare D1 example to include wrangler.json
2 parents 5e0687d + fe50298 commit 4a29281

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

src/content/docs/connect-cloudflare-d1.mdx

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,39 @@ drizzle-orm
3131

3232
#### Step 2 - Initialize the driver and make a query
3333

34-
You would need to have a `wrangler.toml` file for D1 database and will look something like this:
34+
You would need to have either a `wrangler.json` or a `wrangler.toml` file for D1 database and will look something like this:
35+
<CodeTabs items={["wrangler.json", "wrangler.toml"]}>
36+
```json
37+
{
38+
"name": "YOUR_PROJECT_NAME",
39+
"main": "src/index.ts",
40+
"compatibility_date": "2024-09-26",
41+
"compatibility_flags": [
42+
"nodejs_compat"
43+
],
44+
"d1_databases": [
45+
{
46+
"binding": "BINDING_NAME",
47+
"database_name": "YOUR_DB_NAME",
48+
"database_id": "YOUR_DB_ID",
49+
"migrations_dir": "drizzle/migrations"
50+
}
51+
]
52+
}
53+
```
3554
```toml
36-
name = "YOUR PROJECT NAME"
55+
name = "YOUR_PROJECT_NAME"
3756
main = "src/index.ts"
3857
compatibility_date = "2022-11-07"
3958
node_compat = true
4059

4160
[[ d1_databases ]]
42-
binding = "DB"
43-
database_name = "YOUR DB NAME"
44-
database_id = "YOUR DB ID"
61+
binding = "BINDING_NAME"
62+
database_name = "YOUR_DB_NAME"
63+
database_id = "YOUR_DB_ID"
4564
migrations_dir = "drizzle/migrations"
4665
```
66+
</CodeTabs>
4767

4868
Make your first D1 query:
4969
```typescript copy

0 commit comments

Comments
 (0)