diff options
Diffstat (limited to 'packages/db/drizzle.config.ts')
| -rw-r--r-- | packages/db/drizzle.config.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/packages/db/drizzle.config.ts b/packages/db/drizzle.config.ts new file mode 100644 index 00000000..b003e31a --- /dev/null +++ b/packages/db/drizzle.config.ts @@ -0,0 +1,26 @@ +import type { Config } from "drizzle-kit"; +import * as dotenv from "dotenv"; + +// Load the right env file based on environment +if (process.env.NODE_ENV === "production") { + dotenv.config({ path: ".env.production" }); +} else { + dotenv.config({ path: ".env.local" }); +} + +if (!process.env.DATABASE_URL) { + throw new Error("DATABASE_URL is not set"); +} + +export default { + schema: "./src/schema.ts", + dialect: "postgresql", + migrations: { + table: "drizzle_migrations", + }, + dbCredentials: { + url: process.env.DATABASE_URL, + }, + out: "./migrations", + strict: process.env.NODE_ENV === "production", +} satisfies Config;
\ No newline at end of file |
