Skip to content

Commit

Permalink
feat: enable sqlite WAL mode
Browse files Browse the repository at this point in the history
  • Loading branch information
wwills2 committed Jan 15, 2025
1 parent a3d733b commit 31dbde9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/database/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import { Sequelize } from 'sequelize';
import { QueryTypes, Sequelize } from 'sequelize';
import config from '../config/config.js';
import { logger } from '../logger.js';
import mysql from 'mysql2/promise';
Expand Down Expand Up @@ -158,3 +158,17 @@ export const prepareDb = async () => {

await checkForMigrations(sequelize);
};

// Function to set WAL mode
async function setWALMode() {
try {
await sequelize.authenticate();

await sequelize.query('PRAGMA journal_mode=WAL;', { type: QueryTypes.RAW });
console.log('WAL mode set successfully.');
} catch (error) {
console.error('Unable to set WAL mode:', error);
}
}

setWALMode();

0 comments on commit 31dbde9

Please sign in to comment.