Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: add tempStore option to DB

Ammar Ahmede218962c55fa
diff --git a/packages/core/src/database/index.ts b/packages/core/src/database/index.ts
index 4617d0ab1..3b212a2a3 100644
--- a/packages/core/src/database/index.ts
+++ b/packages/core/src/database/index.ts
@@ -201,6 +201,7 @@ export type SQLiteOptions = {
journalMode?: "WAL" | "MEMORY" | "OFF" | "PERSIST" | "TRUNCATE" | "DELETE";
synchronous?: "normal" | "extra" | "full" | "off";
lockingMode?: "normal" | "exclusive";
+ tempStore?: "memory" | "file" | "default";
cacheSize?: number;
pageSize?: number;
};
@@ -228,6 +229,9 @@ export async function createDatabase(options: SQLiteOptions) {
options.pageSize.toString()
)}`.execute(db);
+ if (options.tempStore)
+ await sql`PRAGMA temp_store = ${sql.raw(options.tempStore)}`.execute(db);
+
if (options.cacheSize)
await sql`PRAGMA cache_size = ${sql.raw(
options.cacheSize.toString()