0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Set journal_mode to truncate for SQLite in tests

no issue

- we would regularly see IO errors coming from SQLite, which caused
  random regression tests to fail
- the default journal_mode is `delete`, but this is slow and can cause
  issues when multiple tests try to remove the journal file
- `truncate` is faster and shouldn't cause these issues
This commit is contained in:
Daniel Lockyer 2020-01-30 10:12:42 +00:00
parent ef551768bb
commit 1c6583ae03

View file

@ -931,6 +931,13 @@ startGhost = function startGhost(options) {
settingsCache.reset(); settingsCache.reset();
return knexMigrator.init(); return knexMigrator.init();
}) })
.then(function setPragma() {
if (config.get('database:client') === 'sqlite3') {
return db.knex.raw('PRAGMA journal_mode = TRUNCATE;');
} else {
return Promise.resolve();
}
})
.then(function initializeGhost() { .then(function initializeGhost() {
urlService.resetGenerators(); urlService.resetGenerators();