backup / restoreslop

This commit is contained in:
legop3
2026-09-14 19:09:02 -04:00
parent edc1b825f2
commit 1c34849bd0
32 changed files with 1220 additions and 70 deletions
@@ -118,6 +118,15 @@ function getDb() {
return db;
}
function backupDatabase(destinationPath) {
/*
Keep identity writes live while SQLite copies a transactionally consistent
view into backup staging. Exposing the operation instead of the connection
preserves this service as the sole owner of identity.sqlite.
*/
return getDb().backup(destinationPath);
}
function ensureSchema(conn) {
conn.exec(`
create table if not exists users (
@@ -1087,6 +1096,7 @@ function createJsonStore({ path: filePath, normalizeStoreShape, cloneStore, logg
module.exports = {
identityEvents,
getDb,
backupDatabase,
sanitizeNickname,
normalizeCookieUserId,
isValidCookieUserId,