From 140880a444339e67e641abe3d0496e2915af92d7 Mon Sep 17 00:00:00 2001 From: Hyteq Date: Tue, 24 Jun 2025 11:23:40 +0300 Subject: chore(turborepo): initial setup and config, move db to package --- packages/db/drizzle.config.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 packages/db/drizzle.config.ts (limited to 'packages/db/drizzle.config.ts') 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 -- cgit v1.3.1