DT
Drizzle Team•15mo ago
delight

Drizzle Studio on postgres

While - drizzle-kit generate:pg - drizzle-kit push:pg - drizzle-kit introspect:pg all work also with the postgres driver ... (driver: 'pg' in drizzle.config.ts) - drizzle-kit studio does not and needs additionally the pg package (node-postgres) installed as dependency. Is that something I should open an issue for on github ?
6 Replies
RaSk
RaSk•15mo ago
I had the same problem the other day and thought about opening an Issue with PR too 😉
Angelelz
Angelelz•15mo ago
That seem to be a design choice by the drizzle team. You can probably get away with installing node-postgres as a dev dependency
delight
delightOP•15mo ago
Yes that was my "workaround". But it feels a little inconstistent, as drizzle-kit migrations work with the postgres driver. It is a little confusing on which driver to use (postgres vs. pg). Also I guess there might be similar problems with other drivers lik @Neon/database/serverless @vercel/postgres etc. - haven't tried them yet. If there is no rather easy fix for that I don't think it is worth fixing.
RaSk
RaSk•15mo ago
I'm using @vercel/postgres it works btw using the pg driver but you need to add ?sslmode=require to the Vercel URL
delight
delightOP•15mo ago
interesting and a little weird at the same time oh you still have the pg driver in your dependencies ... I see
RaSk
RaSk•15mo ago
import type { Config } from 'drizzle-kit';
import { loadEnvConfig } from '@next/env';

loadEnvConfig('./');

export default {
schema: './db/schema.ts',
out: './drizzle',
driver: 'pg',
dbCredentials: {
connectionString: process.env.POSTGRES_URL_DRIZZLE_STUDIO ?? ''
}
} satisfies Config;
import type { Config } from 'drizzle-kit';
import { loadEnvConfig } from '@next/env';

loadEnvConfig('./');

export default {
schema: './db/schema.ts',
out: './drizzle',
driver: 'pg',
dbCredentials: {
connectionString: process.env.POSTGRES_URL_DRIZZLE_STUDIO ?? ''
}
} satisfies Config;
Want results from more Discord servers?
Add your server