Merge pull request #966 from SiIky/fix/uIJsiz4J/machine-names-migration

fix: give up on this (now) noop
This commit is contained in:
Rafael Taranto 2021-12-03 17:50:54 +00:00 committed by GitHub
commit dad2c6e66e

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()