From 96181e73dd8f82689f2fb06d29c9e20831849082 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Mon, 11 Dec 2023 15:47:07 +0500 Subject: [PATCH] core: add tempStore option to DB --- packages/core/src/database/index.ts | 4 ++++ 1 file changed, 4 insertions(+) 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()