add guard in init_DB, check for existing folder before db creation
Some checks failed
InnoHub Processor/tatort/pipeline/head There was a failure building this commit

This commit is contained in:
2025-08-22 10:03:39 +02:00
parent 0c000f72a2
commit 323264150b

View File

@@ -1,6 +1,15 @@
import Database from 'better-sqlite3';
import fs from 'fs';
import path from 'path';
const db = new Database('./src/lib/data/tatort.db');
const fullPath = './src/lib/data/tatort.db';
const dir = path.dirname(fullPath);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
const db = new Database(fullPath);
let createSQLStmt = `CREATE TABLE IF NOT EXISTS users
(id INTEGER PRIMARY KEY AUTOINCREMENT,