fix: No data returned from the query errors on migration

This commit is contained in:
siiky 2024-09-19 16:10:18 +01:00
parent bb440eedd6
commit ea9a373676
2 changed files with 2 additions and 2 deletions

View file

@ -92,7 +92,7 @@ function loadLatestConfig (filterSchemaVersion = true) {
order by id desc
limit 1`
return db.one(sql, ['config', configValidate.SETTINGS_LOADER_SCHEMA_VERSION])
return db.oneOrNone(sql, ['config', configValidate.SETTINGS_LOADER_SCHEMA_VERSION])
.then(row => row.data.config)
.then(configValidate.validate)
.catch(err => {

View file

@ -167,7 +167,7 @@ function loadLatestConfig () {
ORDER BY id DESC
LIMIT 1`
return db.one(sql, [NEW_SETTINGS_LOADER_SCHEMA_VERSION])
return db.oneOrNone(sql, [NEW_SETTINGS_LOADER_SCHEMA_VERSION])
.then(row => row ? row.data.config : {})
.catch(err => {
throw err