Fix m00001 migration by using targetValues

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2018-11-13 22:08:44 +00:00
parent c9b7ebd74d
commit 96ecef8052
No known key found for this signature in database
GPG Key ID: 69264F9C923F55C1

View File

@ -8,13 +8,13 @@ exports.up = function (knex, Promise) {
.then((devConfigs) => {
const devConfig = devConfigs[0];
const targetValues = JSON.parse(devConfig.targetValues);
const filteredTargetValues = _.mapKeys( (_v, k) => {
const filteredTargetValues = _.mapKeys(targetValues, (_v, k) => {
return k.replace(/^(?:RESIN|BALENA)_(.*)/, '$1');
});
return knex('deviceConfig').update({ targetValues: JSON.stringify(filteredTargetValues) });
});
}
};
exports.down = function (knex, Promise) {
return Promise.reject(new Error('Not Implemented'));
}
};