Merge pull request #966 from SiIky/fix/uIJsiz4J/machine-names-migration
fix: give up on this (now) noop
This commit is contained in:
commit
dad2c6e66e
1 changed files with 4 additions and 21 deletions
|
|
@ -18,27 +18,10 @@ module.exports.up = function (next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadLatest(OLD_SETTINGS_LOADER_SCHEMA_VERSION)
|
loadLatest(OLD_SETTINGS_LOADER_SCHEMA_VERSION)
|
||||||
.then(async settings => {
|
.then(settings => _.isEmpty(settings.config)
|
||||||
if (_.isEmpty(settings.config)) {
|
? next()
|
||||||
return {
|
: migrateConfig(settings)
|
||||||
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))
|
|
||||||
})
|
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err.message === 'lamassu-server is not configured') {
|
if (err.message === 'lamassu-server is not configured') {
|
||||||
return next()
|
return next()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue