Fix SQLite database path to match emdash init location

The emdash CLI creates the database at ./data.db relative to the
workspace root (/app/emdash/data.db), but the Astro config was
pointing to ./storage/data.db. This caused getEmDashEntry() to
return null since the database used at runtime was empty.

Change db.ts to use file:./data.db instead of file:./storage/data.db

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kunthawat Greethong
2026-05-04 07:33:27 +07:00
parent 88902c3b38
commit 71e05f9d2c

View File

@@ -12,8 +12,8 @@ export function getDatabaseConfig() {
const url = process.env.DATABASE_URL; const url = process.env.DATABASE_URL;
if (!url) { if (!url) {
// Default to SQLite // Default to SQLite - matches where emdash init creates the database
return sqlite({ url: "file:./storage/data.db" }); return sqlite({ url: "file:./data.db" });
} }
if (url.startsWith("file:")) { if (url.startsWith("file:")) {
@@ -28,5 +28,5 @@ export function getDatabaseConfig() {
// Fallback to SQLite // Fallback to SQLite
console.warn(`Unknown DATABASE_URL protocol, falling back to SQLite`); console.warn(`Unknown DATABASE_URL protocol, falling back to SQLite`);
return sqlite({ url: "file:./storage/data.db" }); return sqlite({ url: "file:./data.db" });
} }