|
|
|
@ -38,7 +38,7 @@ class Database {
|
|
|
|
|
|
|
|
|
|
// Change to WAL
|
|
|
|
|
await R.exec("PRAGMA journal_mode = WAL");
|
|
|
|
|
|
|
|
|
|
console.log(await R.getAll("PRAGMA journal_mode"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static async patch() {
|
|
|
|
@ -124,11 +124,18 @@ class Database {
|
|
|
|
|
return statement !== "";
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Use better-sqlite3 to run, prevent "This statement does not return data. Use run() instead"
|
|
|
|
|
const db = await this.getBetterSQLite3Database();
|
|
|
|
|
|
|
|
|
|
for (let statement of statements) {
|
|
|
|
|
await R.exec(statement);
|
|
|
|
|
db.prepare(statement).run();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getBetterSQLite3Database() {
|
|
|
|
|
return R.knex.client.acquireConnection();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Special handle, because tarn.js throw a promise reject that cannot be caught
|
|
|
|
|
* @returns {Promise<void>}
|
|
|
|
|