From fad165f55facf473a3cadfe4cae4132d8e852476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20S=C3=A1?= Date: Tue, 30 Nov 2021 20:14:03 +0000 Subject: [PATCH] fix: don't update machine names from queried machine names --- migrations/1599523522436-migrate-config.js | 25 ++++------------------ 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/migrations/1599523522436-migrate-config.js b/migrations/1599523522436-migrate-config.js index 75d3c954..3c9cf20d 100644 --- a/migrations/1599523522436-migrate-config.js +++ b/migrations/1599523522436-migrate-config.js @@ -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()