From 037a10e93e8e6bd70784f2c1f02ac54debf8438e Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Thu, 8 Jan 2026 11:17:51 +0100 Subject: [PATCH] Fixed DB --- backend/db/index.ts | 2 ++ backend/src/plugins/db.ts | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/db/index.ts b/backend/db/index.ts index 4bc7093..974f8d9 100644 --- a/backend/db/index.ts +++ b/backend/db/index.ts @@ -3,6 +3,8 @@ import { Pool } from "pg" import {secrets} from "../src/utils/secrets"; import * as schema from "./schema" + + export const pool = new Pool({ connectionString: secrets.DATABASE_URL, max: 10, // je nach Last diff --git a/backend/src/plugins/db.ts b/backend/src/plugins/db.ts index 9ad6377..36e46bc 100644 --- a/backend/src/plugins/db.ts +++ b/backend/src/plugins/db.ts @@ -1,9 +1,18 @@ import fp from "fastify-plugin" import {drizzle, NodePgDatabase} from "drizzle-orm/node-postgres" -import { db, pool } from "../../db" import * as schema from "../../db/schema" +import {secrets} from "../utils/secrets"; +import { Pool } from "pg" export default fp(async (server, opts) => { + + const pool = new Pool({ + connectionString: secrets.DATABASE_URL, + max: 10, // je nach Last + }) + + const db = drizzle(pool , {schema}) + // Dekorieren -> überall server.db server.decorate("db", db)