30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import "dotenv/config";
|
|
import {
|
|
PRISMA_MIGRATIONS_PATH,
|
|
PRISMA_SCHEMA_PATH,
|
|
PRISMA_SEED_COMMAND,
|
|
} from "@hivegrid/db/prisma";
|
|
import { defineConfig, env } from "prisma/config";
|
|
|
|
export default defineConfig({
|
|
schema: PRISMA_SCHEMA_PATH,
|
|
migrations: {
|
|
path: PRISMA_MIGRATIONS_PATH,
|
|
seed: PRISMA_SEED_COMMAND,
|
|
},
|
|
datasource: {
|
|
// Prisma Migrate must run against the unpooled Postgres connection.
|
|
// PgBouncer in transaction mode breaks Migrate's prepared statements,
|
|
// so we route Migrate through DIRECT_URL (port 5432). Falls back to
|
|
// DATABASE_URL when DIRECT_URL is not set (single-tier dev setups
|
|
// without PgBouncer). See docs/ops/pgbouncer.md.
|
|
url: env(process.env.DIRECT_URL ? "DIRECT_URL" : "DATABASE_URL"),
|
|
// Optional shadow DB for `prisma migrate diff --from-migrations` (Prisma 7
|
|
// removed the --shadow-database-url flag). Used by the migrations/schema
|
|
// parity check; regular migrate deploy/status ignore it.
|
|
...(process.env.SHADOW_DATABASE_URL
|
|
? { shadowDatabaseUrl: env("SHADOW_DATABASE_URL") }
|
|
: {}),
|
|
},
|
|
});
|