Skip to content

Commit 48e5406

Browse files
Netlify-DB for main (#5663)
* Fixed pg-native Pool detection in node-postgres transactions breaking in environments with forbidden `require()` (fixes #5107) * Netlify Database for `main` * Unskipped functional test cases * Updated secrets * DPRINT * Release Notes --------- Co-authored-by: AndriiSherman <andreysherman11@gmail.com>
1 parent 273c780 commit 48e5406

13 files changed

Lines changed: 1290 additions & 7 deletions

File tree

.github/workflows/release-feature-branch.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
required: true
1010
# NEON_HTTP_CONNECTION_STRING:
1111
# required: true
12+
NETLIFY_DB_URL:
13+
required: true
1214
TIDB_CONNECTION_STRING:
1315
required: true
1416
XATA_API_KEY:
@@ -35,6 +37,7 @@ jobs:
3537
- singlestore-custom
3638
- neon-http
3739
- neon-serverless
40+
- netlify-db
3841
- drizzle-orm
3942
- drizzle-kit
4043
- drizzle-zod
@@ -152,6 +155,7 @@ jobs:
152155
# NEON_HTTP_CONNECTION_STRING: postgres://postgres:postgres@db.localtest.me:5432/postgres
153156
NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
154157
NEON_SERVERLESS_CONNECTION_STRING: postgres://postgres:postgres@localhost:5445/postgres
158+
NETLIFY_DB_URL: ${{ secrets.NETLIFY_DB_URL }}
155159
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
156160
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
157161
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
@@ -210,6 +214,10 @@ jobs:
210214
docker compose -f docker-neon.yml down
211215
;;
212216
217+
netlify-db)
218+
pnpm vitest run tests/pg/netlify-db.test.ts
219+
;;
220+
213221
drizzle-orm|drizzle-kit|drizzle-zod|drizzle-seed|drizzle-typebox|drizzle-valibot|drizzle-arktype)
214222
(cd .. && pnpm test --filter ${{ matrix.shard }})
215223
;;
@@ -226,7 +234,8 @@ jobs:
226234
--exclude tests/singlestore/singlestore-custom.test.ts \
227235
--exclude tests/pg/neon-http.test.ts \
228236
--exclude tests/pg/neon-http-batch.test.ts \
229-
--exclude tests/pg/neon-serverless.test.ts
237+
--exclude tests/pg/neon-serverless.test.ts \
238+
--exclude tests/pg/netlify-db.test.ts
230239
;;
231240
232241
esac

.github/workflows/release-latest.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
required: true
1010
# NEON_HTTP_CONNECTION_STRING:
1111
# required: true
12+
NETLIFY_DB_URL:
13+
required: true
1214
TIDB_CONNECTION_STRING:
1315
required: true
1416
XATA_API_KEY:
@@ -33,6 +35,7 @@ jobs:
3335
- singlestore-custom
3436
- neon-http
3537
- neon-serverless
38+
- netlify-db
3639
- drizzle-orm
3740
- drizzle-kit
3841
- drizzle-zod
@@ -150,6 +153,7 @@ jobs:
150153
# NEON_HTTP_CONNECTION_STRING: postgres://postgres:postgres@db.localtest.me:5432/postgres
151154
NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
152155
NEON_SERVERLESS_CONNECTION_STRING: postgres://postgres:postgres@localhost:5445/postgres
156+
NETLIFY_DB_URL: ${{ secrets.NETLIFY_DB_URL }}
153157
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
154158
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
155159
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
@@ -198,6 +202,10 @@ jobs:
198202
docker compose -f docker-neon.yml down
199203
;;
200204
205+
netlify-db)
206+
pnpm vitest run tests/pg/netlify-db.test.ts
207+
;;
208+
201209
drizzle-orm|drizzle-kit|drizzle-zod|drizzle-seed|drizzle-typebox|drizzle-valibot|drizzle-arktype)
202210
(cd .. && pnpm test --filter ${{ matrix.shard }})
203211
;;
@@ -214,7 +222,8 @@ jobs:
214222
--exclude tests/singlestore/singlestore-custom.test.ts \
215223
--exclude tests/pg/neon-http.test.ts \
216224
--exclude tests/pg/neon-http-batch.test.ts \
217-
--exclude tests/pg/neon-serverless.test.ts
225+
--exclude tests/pg/neon-serverless.test.ts \
226+
--exclude tests/pg/netlify-db.test.ts
218227
;;
219228
220229
esac

.github/workflows/router.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
3636
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
3737
# NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
38+
NETLIFY_DB_URL: ${{ secrets.NETLIFY_DB_URL }}
3839
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
3940
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
4041
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}
@@ -49,6 +50,7 @@ jobs:
4950
PLANETSCALE_CONNECTION_STRING: ${{ secrets.PLANETSCALE_CONNECTION_STRING }}
5051
NEON_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
5152
# NEON_HTTP_CONNECTION_STRING: ${{ secrets.NEON_CONNECTION_STRING }}
53+
NETLIFY_DB_URL: ${{ secrets.NETLIFY_DB_URL }}
5254
TIDB_CONNECTION_STRING: ${{ secrets.TIDB_CONNECTION_STRING }}
5355
XATA_API_KEY: ${{ secrets.XATA_API_KEY }}
5456
XATA_BRANCH: ${{ secrets.XATA_BRANCH }}

changelogs/drizzle-orm/0.45.3.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## New Netlify DB Driver
2+
3+
> Note: The Netlify DB driver is developed and maintained by the Netlify team.
4+
5+
**Installation:**
6+
```bash
7+
npm i @netlify/db
8+
```
9+
10+
**Usage example:**
11+
```typescript
12+
import { drizzle } from 'drizzle-orm/netlify-db';
13+
14+
// reads NETLIFY_DB_URL and NETLIFY_DB_DRIVER env vars
15+
const db = drizzle();
16+
17+
const result = await db.execute('select 1');
18+
```
19+
20+
```typescript
21+
import { drizzle } from 'drizzle-orm/netlify-db';
22+
23+
const db = drizzle(process.env.DATABASE_URL);
24+
25+
const result = await db.execute('select 1');
26+
```
27+
28+
```typescript
29+
import { drizzle } from 'drizzle-orm/netlify-db';
30+
31+
// Explicit client — consumer controls the driver
32+
const db = drizzle({ client: netlifyDbClient });
33+
34+
const result = await db.execute('select 1');
35+
```

drizzle-orm/package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "drizzle-orm",
3-
"version": "0.45.2",
3+
"version": "0.45.3",
44
"description": "Drizzle ORM package for SQL databases",
55
"type": "module",
66
"scripts": {
@@ -59,20 +59,21 @@
5959
"@types/better-sqlite3": "*",
6060
"@types/pg": "*",
6161
"@types/sql.js": "*",
62+
"@upstash/redis": ">=1.34.7",
6263
"@vercel/postgres": ">=0.8.0",
6364
"@xata.io/client": "*",
6465
"better-sqlite3": ">=7",
6566
"bun-types": "*",
6667
"expo-sqlite": ">=14.0.0",
68+
"gel": ">=2",
6769
"knex": "*",
6870
"kysely": "*",
6971
"mysql2": ">=2",
72+
"@netlify/db": ">=0.4.0",
7073
"pg": ">=8",
7174
"postgres": ">=3",
7275
"sql.js": ">=1",
73-
"sqlite3": ">=5",
74-
"gel": ">=2",
75-
"@upstash/redis": ">=1.34.7"
76+
"sqlite3": ">=5"
7677
},
7778
"peerDependenciesMeta": {
7879
"mysql2": {
@@ -114,6 +115,9 @@
114115
"@neondatabase/serverless": {
115116
"optional": true
116117
},
118+
"@netlify/db": {
119+
"optional": true
120+
},
117121
"bun-types": {
118122
"optional": true
119123
},
@@ -171,6 +175,7 @@
171175
"@libsql/client-wasm": "^0.10.0",
172176
"@miniflare/d1": "^2.14.4",
173177
"@neondatabase/serverless": "^0.10.0",
178+
"@netlify/db": "^0.4.0",
174179
"@op-engineering/op-sqlite": "^2.0.16",
175180
"@opentelemetry/api": "^1.4.1",
176181
"@originjs/vite-plugin-commonjs": "^1.0.3",

0 commit comments

Comments
 (0)