core: add tempStore option to DB

This commit is contained in:
Ammar Ahmed
2023-12-11 15:47:07 +05:00
committed by Abdullah Atta
parent 5612820aac
commit 96181e73dd

View File

@@ -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()