You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1cb87d4
Browse filesBrowse the repository at this point in the historyBrowse files
Install this for NuxtHub's default PostgreSQL auto-detection. NuxtHub uses `postgres-js` when `DATABASE_URL`, `POSTGRES_URL`, or `POSTGRESQL_URL` is set, and uses `@electric-sql/pglite` as the local fallback when no connection URL is set.
For Cloudflare D1, configure the database ID in your `nuxt.config.ts` and NuxtHub auto-generates the wrangler bindings.
43
-
::
62
+
::::
44
63
:::
45
64
::
46
65
@@ -322,6 +341,32 @@ This driver requires the following environment variable:
322
341
You can find your Neon connection string in the [Neon dashboard](https://console.neon.tech). The connection string format is `postgresql://user:password@hostname/database`.
323
342
::
324
343
344
+
### Node Postgres
345
+
346
+
Use the `node-postgres` driver to connect with Drizzle's [`drizzle-orm/node-postgres`](https://orm.drizzle.team/docs/connect-planetscale-postgres#node-postgres) driver. This is useful for standard PostgreSQL clients, including PlanetScale Postgres.
347
+
348
+
```ts [nuxt.config.ts]
349
+
exportdefaultdefineNuxtConfig({
350
+
hub: {
351
+
db: {
352
+
dialect: 'postgresql',
353
+
driver: 'node-postgres'
354
+
}
355
+
}
356
+
})
357
+
```
358
+
359
+
Install the required dependencies:
360
+
361
+
:pm-install{name="drizzle-orm drizzle-kit pg"}
362
+
:pm-install{name="@types/pg"dev}
363
+
364
+
NuxtHub does not auto-detect `node-postgres`; set `driver: 'node-postgres'` explicitly. When `DATABASE_URL`, `POSTGRES_URL`, or `POSTGRESQL_URL` is set, NuxtHub passes it to Drizzle as the `pg``connectionString`. Otherwise, `pg` reads the `PGHOST`, `PGPORT`, `PGDATABASE`, `PGUSER`, and `PGPASSWORD` environment variables at runtime.
365
+
366
+
::note
367
+
Read replicas and Cloudflare Hyperdrive are not supported with `node-postgres` yet. Use `postgres-js` for them.
368
+
::
369
+
325
370
### Docker/Kubernetes Deployments
326
371
327
372
Build container images without database credentials by deferring environment resolution to runtime. Set the driver explicitly and disable automatic migrations during build and dev:
@@ -347,7 +392,7 @@ Build container images without database credentials by deferring environment res
347
392
hub: {
348
393
db: {
349
394
dialect: 'postgresql',
350
-
driver: 'postgres-js', // or 'neon-http'
395
+
driver: 'postgres-js', // or 'neon-http' or 'node-postgres'
thrownewError(`\`${config.driver}\` driver requires \`DATABASE_URL\`, \`POSTGRES_URL\`, or \`POSTGRESQL_URL\` environment variable when \`applyMigrationsDuringBuild\` is enabled`)
0 commit comments