Database-Layout

Das Datanbankschema wurde an das alte angepasst.
!!Hinzugefügt wurde 'User'!!
This commit is contained in:
rudi committed 2026-07-30 11:48:00 +02:00
1 parent 9aa94638d9
commit 4ccd860814
3 files changed
+82 -14

No files matched your search

+2 -11
View File
@@ -1,14 +1,5 @@
import Database from "better-sqlite3";
import path from "path";
import { prisma } from "@/lib/db/prisma";
const dbPath = path.join(process.cwd(), "songs.db");
// Verhindert, dass Next.js bei jedem Reload die DB neu öffnet
const globalForDb = globalThis as unknown as { db: Database.Database | undefined };
export const db = globalForDb.db ?? new Database(dbPath);
if (process.env.NODE_ENV !== "production") globalForDb.db = db;
db.exec(`
CREATE TABLE IF NOT EXISTS songs (
@@ -185,4 +176,4 @@ export async function addSongbook(name: string, language: string) {
} catch (error) {
return null;
}
}
}