Merge pull request #809 from balena-io/fix-m00001

Fix m00001 migration by using targetValues
This commit is contained in:
CameronDiver 2018-11-13 23:26:49 +01:00 committed by GitHub
commit aef4ec53a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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'));
}
};