diff --git a/src/lib/feed.ts b/src/lib/feed.ts index 650fe36..bd69f88 100644 --- a/src/lib/feed.ts +++ b/src/lib/feed.ts @@ -22,7 +22,7 @@ export function recreateDb(): BetterSqlite3.Database { const db = BetterSqlite3('data/local.sqlite'); - db.prepare( + return db.exec( ` CREATE TABLE IF NOT EXISTS articles ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -35,9 +35,7 @@ export function recreateDb(): BetterSqlite3.Database { favicon TEXT ) ` - ).run(); - - return db; + ); } export function generateFeed(items: FeedItem[]): Feed { diff --git a/src/routes/articles/clear/+server.ts b/src/routes/articles/clear/+server.ts index fe67305..947c890 100644 --- a/src/routes/articles/clear/+server.ts +++ b/src/routes/articles/clear/+server.ts @@ -7,7 +7,7 @@ export const POST: RequestHandler = async ({ request }) => { return new Response(undefined, { status: 401, statusText: 'Missing bearer token' }); } - recreateDb().prepare('DROP TABLE articles').run(); + recreateDb().exec('DROP TABLE articles'); recreateDb(); return new Response(undefined, {