Skip to content

Commit

Permalink
fix: capacitor does not correctly set journal mode (#7873)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswep committed Jul 9, 2021
1 parent d449454 commit 5f20eb7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/driver/capacitor/CapacitorDriver.ts
Expand Up @@ -86,10 +86,15 @@ export class CapacitorDriver extends AbstractSqliteDriver {
// working properly. this also makes onDelete to work with sqlite.
await connection.query(`PRAGMA foreign_keys = ON`, []);

if (this.options.journalMode) {
await connection.query(`PRAGMA journal_mode = ?`, [
this.options.journalMode,
]);
if (
this.options.journalMode &&
["DELETE", "TRUNCATE", "PERSIST", "MEMORY", "WAL", "OFF"].indexOf(
this.options.journalMode
) !== -1
) {
await connection.query(
`PRAGMA journal_mode = ${this.options.journalMode}`
);
}

return connection;
Expand Down

0 comments on commit 5f20eb7

Please sign in to comment.