updated for prisma.config.ts as hardcode db url
This commit is contained in:
@@ -1,23 +1,31 @@
|
||||
// prisma.config.ts
|
||||
import { defineConfig, env } from "prisma/config";
|
||||
import { defineConfig } from "prisma/config";
|
||||
import "dotenv/config";
|
||||
|
||||
// Important: don't hard-fail when DATABASE_URL isn't present during Docker build.
|
||||
// Prisma Client generation does not require a DB connection.
|
||||
const DATABASE_URL = process.env.DATABASE_URL;
|
||||
const DIRECT_URL = process.env.DIRECT_URL;
|
||||
|
||||
export default defineConfig({
|
||||
schema: "prisma/schema.prisma",
|
||||
|
||||
// Ensure Prisma knows where your migration folders live
|
||||
migrations: {
|
||||
path: "prisma/migrations",
|
||||
},
|
||||
|
||||
datasource: {
|
||||
// Runtime (often pooler / transaction mode / supavisor, etc.)
|
||||
url: env("DATABASE_URL"),
|
||||
// Provide a harmless placeholder during build if DATABASE_URL isn't set.
|
||||
// This allows `prisma generate` to run in Docker build stages.
|
||||
url:
|
||||
DATABASE_URL ??
|
||||
"postgresql://user:pass@localhost:5432/postgres?schema=public",
|
||||
|
||||
// Migrations should be direct-to-Postgres (no pooler; stable connections)
|
||||
directUrl: env("DIRECT_URL"),
|
||||
// Direct URL is only needed for migrate; placeholder is fine for build.
|
||||
directUrl:
|
||||
DIRECT_URL ??
|
||||
"postgresql://user:pass@localhost:5432/postgres?schema=public",
|
||||
},
|
||||
|
||||
// Optional, if you use `prisma db seed`
|
||||
seed: "tsx prisma/seed.ts",
|
||||
});
|
||||
Reference in New Issue
Block a user