feat: implement prepareSqlitePath function and add tests for database path handling

This commit is contained in:
MythEclipse
2026-05-16 00:12:31 +07:00
parent acd4648d49
commit c6ee7bb8c6
4 changed files with 39 additions and 2 deletions
+12
View File
@@ -0,0 +1,12 @@
import { mkdirSync } from "node:fs";
import { dirname } from "node:path";
export function prepareSqlitePath(databaseUrl: string): string {
const sqlitePath = databaseUrl.replace(/^file:/, "");
if (sqlitePath !== ":memory:") {
mkdirSync(dirname(sqlitePath), { recursive: true });
}
return sqlitePath;
}