fix(01-01): use DIRECT_URL for Prisma CLI — PgBouncer pooler hangs on schema push

This commit is contained in:
admin committed 2026-06-06 09:34:29 +02:00
1 parent 091c2dc0e4
commit 43faa35795
1 file changed
+5 -3
+5 -3
View File
@@ -20,12 +20,14 @@ function loadEnvFile(filename: string) {
loadEnvFile(".env");
loadEnvFile(".env.local"); // Next.js convention — takes priority
const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) throw new Error("DATABASE_URL is not set in .env or .env.local");
// Prisma CLI (db push, migrate) needs the DIRECT connection (port 5432).
// The pooled URL (PgBouncer, port 6543) hangs on schema operations.
const directUrl = process.env.DIRECT_URL ?? process.env.DATABASE_URL;
if (!directUrl) throw new Error("DIRECT_URL (or DATABASE_URL) is not set in .env or .env.local");
export default defineConfig({
schema: "prisma/schema.prisma",
datasource: {
url: databaseUrl,
url: directUrl,
},
});