refactor: use loadLatestConfig() in place of loadLatest() where applicable

This commit is contained in:
siiky 2024-09-17 15:38:35 +01:00
parent 5342e9a8be
commit cac88fda45
15 changed files with 52 additions and 56 deletions

View file

@ -9,8 +9,8 @@ module.exports = {migrateNames}
function migrateNames () {
const cs = new pgp.helpers.ColumnSet(['?device_id', 'name'], {table: 'devices'})
return settingsLoader.loadLatest(false)
.then(r => machineLoader.getMachineNames(r.config))
return settingsLoader.loadLatestConfig(false)
.then(config => machineLoader.getMachineNames(config))
.then(_.map(r => ({device_id: r.deviceId, name: r.name})))
.then(data => pgp.helpers.update(data, cs) + ' WHERE t.device_id=v.device_id')
}