-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathprisma.config.ts
More file actions
30 lines (26 loc) · 1.02 KB
/
prisma.config.ts
File metadata and controls
30 lines (26 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// prisma.config.ts
import type { PrismaConfig } from "prisma/config";
// Prisma CLI configuration migrated from package.json#prisma (deprecated in Prisma 7)
// See: https://www.prisma.io/docs/orm/reference/prisma-config-reference#configuration-interface
// NOTE: `datasource` is optional for most commands (e.g. `prisma generate`).
// It is required for migration / introspection commands.
// We avoid hard-failing when the URL isn't present so Docker builds (and local installs)
// can run `prisma generate` without needing DB env vars at build time.
const databaseUrl = process.env.DIRECT_URL ?? process.env.DATABASE_URL;
const config: PrismaConfig = {
// Explicitly set schema path (defaults to prisma/schema.prisma)
schema: "prisma/schema.prisma",
migrations: {
path: "prisma/migrations",
// Mirrors previously used seed command from package.json#prisma
seed: "tsx prisma/seed.ts",
},
...(databaseUrl
? {
datasource: {
url: databaseUrl,
},
}
: {}),
};
export default config;