24 lines
773 B
TypeScript
24 lines
773 B
TypeScript
import "dotenv/config";
|
|
import {
|
|
PRISMA_MIGRATIONS_PATH,
|
|
PRISMA_SCHEMA_PATH,
|
|
PRISMA_SEED_COMMAND,
|
|
} from "@toolctrl/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"),
|
|
},
|
|
});
|