Merge remote-tracking branch 'upstream/release-7.5.0' into chore/merge-release-into-dev-21-16-12

This commit is contained in:
Taranto 2021-12-16 13:38:43 +00:00
commit e9b2280fc3
33 changed files with 250 additions and 64 deletions

View file

@ -18,27 +18,10 @@ module.exports.up = function (next) {
}
loadLatest(OLD_SETTINGS_LOADER_SCHEMA_VERSION)
.then(async settings => {
if (_.isEmpty(settings.config)) {
return {
settings,
machines: []
}
}
return {
settings,
machines: await machineLoader.getMachineNames(settings.config)
}
})
.then(({ settings, machines }) => {
if (_.isEmpty(settings.config)) {
return next()
}
const sql = machines
? machines.map(m => `update devices set name = '${m.name}' where device_id = '${m.deviceId}'`)
: []
return db.multi(sql, () => migrateConfig(settings))
})
.then(settings => _.isEmpty(settings.config)
? next()
: migrateConfig(settings)
)
.catch(err => {
if (err.message === 'lamassu-server is not configured') {
return next()