Destroyed connection before restoring DB file

no issue

- we've seen some instances of SQLite saying "database disk image is malformed"
- I think this happens because we copy the file whilst we are still connected to
  the old DB
- this commit destroys the connection before copying the clean file to the live
  DB file
This commit is contained in:
Daniel Lockyer 2021-12-07 08:23:51 +00:00
parent 9c0752896c
commit 4673bd05fc
No known key found for this signature in database
GPG Key ID: D21186F0B47295AD

View File

@ -26,6 +26,7 @@ module.exports.reset = async () => {
const dbExists = await fs.pathExists(filenameOrig);
if (dbExists) {
await db.knex.destroy();
await fs.copyFile(filenameOrig, filename);
} else {
await knexMigrator.reset({force: true});