fix: remove unused crypto unit fields
This commit is contained in:
parent
3b01820242
commit
65b8491354
4 changed files with 38 additions and 11 deletions
22
migrations/1658940716689-remove-coin-specific-cryptounits.js
Normal file
22
migrations/1658940716689-remove-coin-specific-cryptounits.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
const { removeFromConfig, loadLatest } = require('../lib/new-settings-loader')
|
||||
const { getCryptosFromWalletNamespace } = require('../lib/new-config-manager.js')
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
exports.up = function (next) {
|
||||
loadLatest()
|
||||
.then(settings => {
|
||||
const configuredCryptos = getCryptosFromWalletNamespace(settings.config)
|
||||
if (!configuredCryptos.length) return Promise.resolve()
|
||||
|
||||
return removeFromConfig(_.map(it => `wallets_${it}_cryptoUnits`, configuredCryptos))
|
||||
})
|
||||
.then(() => next())
|
||||
.catch(err => {
|
||||
console.log(err.message)
|
||||
return next(err)
|
||||
})
|
||||
}
|
||||
|
||||
exports.down = function (next) {
|
||||
next()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue