add guard to dbService checking for directory existence
All checks were successful
InnoHub Processor/tatort/pipeline/head This commit looks good
All checks were successful
InnoHub Processor/tatort/pipeline/head This commit looks good
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
import Database from 'better-sqlite3';
|
import Database from 'better-sqlite3';
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
export 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const db = new Database(fullPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user