From b40c8eae06750400e637d58b62ad8f8eab225645 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Fri, 13 Mar 2026 21:55:45 +0100 Subject: [PATCH] Add function to export database snapshot --- src/lib/db.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/db.ts b/src/lib/db.ts index a0a955c..2aab18d 100644 --- a/src/lib/db.ts +++ b/src/lib/db.ts @@ -434,3 +434,9 @@ export async function deleteTextVersion(promptId: string, versionId: string) { [nextId, promptId] ); } + +export async function exportDatabaseSnapshot(destinationPath: string) { + const db = await getDb(); + const escapedPath = destinationPath.replace(/'/g, "''"); + await db.execute(`VACUUM INTO '${escapedPath}'`); +}