journal_mode=WAL and synchronous=NORMAL for database
This commit is contained in:
parent
2d8f237b76
commit
5f9a75d9f4
1 changed files with 6 additions and 0 deletions
|
@ -315,6 +315,10 @@ async function setUserVersion(
|
||||||
async function keyDatabase(instance: PromisifiedSQLDatabase, key: string) {
|
async function keyDatabase(instance: PromisifiedSQLDatabase, key: string) {
|
||||||
// https://www.zetetic.net/sqlcipher/sqlcipher-api/#key
|
// https://www.zetetic.net/sqlcipher/sqlcipher-api/#key
|
||||||
await instance.run(`PRAGMA key = "x'${key}'";`);
|
await instance.run(`PRAGMA key = "x'${key}'";`);
|
||||||
|
|
||||||
|
// https://sqlite.org/wal.html
|
||||||
|
await instance.run('PRAGMA journal_mode = WAL;');
|
||||||
|
await instance.run('PRAGMA synchronous = NORMAL;');
|
||||||
}
|
}
|
||||||
async function getUserVersion(instance: PromisifiedSQLDatabase) {
|
async function getUserVersion(instance: PromisifiedSQLDatabase) {
|
||||||
const row = await instance.get('PRAGMA user_version;');
|
const row = await instance.get('PRAGMA user_version;');
|
||||||
|
@ -1928,6 +1932,8 @@ async function removeDB() {
|
||||||
}
|
}
|
||||||
|
|
||||||
rimraf.sync(databaseFilePath);
|
rimraf.sync(databaseFilePath);
|
||||||
|
rimraf.sync(`${databaseFilePath}-shm`);
|
||||||
|
rimraf.sync(`${databaseFilePath}-wal`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeIndexedDBFiles() {
|
async function removeIndexedDBFiles() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue