From a60800ad0183a235795cc5fc229f74d1e3fafac8 Mon Sep 17 00:00:00 2001 From: Markus Thielker Date: Sat, 4 Jan 2025 10:17:34 +0100 Subject: [PATCH] NORY-41: add basic drizzle configuration --- dashboard/drizzle.config.ts | 14 ++++++++++++++ dashboard/drizzle/relations.ts | 0 dashboard/drizzle/schema.ts | 0 dashboard/src/db/index.ts | 10 ++++++++++ dashboard/src/db/schema.ts | 0 5 files changed, 24 insertions(+) create mode 100644 dashboard/drizzle.config.ts create mode 100644 dashboard/drizzle/relations.ts create mode 100644 dashboard/drizzle/schema.ts create mode 100644 dashboard/src/db/index.ts create mode 100644 dashboard/src/db/schema.ts diff --git a/dashboard/drizzle.config.ts b/dashboard/drizzle.config.ts new file mode 100644 index 0000000..21ed5ad --- /dev/null +++ b/dashboard/drizzle.config.ts @@ -0,0 +1,14 @@ +'use server'; + +import 'dotenv/config'; +import { defineConfig } from 'drizzle-kit'; + + +export default defineConfig({ + out: './drizzle', + schema: './src/db/schema.ts', + dialect: 'postgresql', + dbCredentials: { + url: process.env.DATABASE_URL!, + }, +}); diff --git a/dashboard/drizzle/relations.ts b/dashboard/drizzle/relations.ts new file mode 100644 index 0000000..e69de29 diff --git a/dashboard/drizzle/schema.ts b/dashboard/drizzle/schema.ts new file mode 100644 index 0000000..e69de29 diff --git a/dashboard/src/db/index.ts b/dashboard/src/db/index.ts new file mode 100644 index 0000000..8b0e187 --- /dev/null +++ b/dashboard/src/db/index.ts @@ -0,0 +1,10 @@ +'use server'; + +import 'dotenv/config'; +import { drizzle } from 'drizzle-orm/node-postgres'; + +const db = drizzle(process.env.DATABASE_URL!); + +export async function getDB() { + return db; +} diff --git a/dashboard/src/db/schema.ts b/dashboard/src/db/schema.ts new file mode 100644 index 0000000..e69de29