From ebd53996d7d55c45e134e923933b5e71705b62ed Mon Sep 17 00:00:00 2001 From: Bobby Date: Tue, 4 Oct 2022 07:13:36 +0700 Subject: [PATCH] fix: use fs-jetpack in scripts/migrate.js --- scripts/migrate.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/scripts/migrate.js b/scripts/migrate.js index 1e827aa..ce87a19 100644 --- a/scripts/migrate.js +++ b/scripts/migrate.js @@ -1,4 +1,4 @@ -const paths = require('./../controllers/pathsController') +const jetpack = require('fs-jetpack') const perms = require('./../controllers/permissionController') const config = require('./../config') @@ -22,14 +22,9 @@ const map = { ;(async () => { if (['better-sqlite3', 'sqlite3'].includes(config.database.client)) { - try { - await paths.access(config.database.connection.filename) - } catch (err) { - if (err.code === 'ENOENT') { - console.log('Sqlite3 database file missing. Assumes first install, migration skipped.') - process.exit(0) - } - throw err + if (!await jetpack.existsAsync(config.database.connection.filename)) { + console.log('Sqlite3 database file missing. Assumes first install, migration skipped.') + process.exit(0) } }