* dev: (85 commits) chore: console.log debug leftovers fix: third level navigation links fix: show subheader on refresh fix: machines/:id routing fix: customer route chore: update wallet nodes feat: shorten long addresses in funding page feat: shorten long addresses refactor: support copied text different from presented text chore: udpate react, downshift and routing refactor: use Wizard component on first route fix: autocomplete component rendering feat: skip2fa option on .env fix: drop contraint before dropping index chore: stop using alias imports fix: re-instate urlResolver chore: server code formatting chore: reformat code chore: adding eslint and prettier config chore: typo ...
59 lines
1.7 KiB
JavaScript
59 lines
1.7 KiB
JavaScript
var db = require('./db')
|
|
const _ = require('lodash/fp')
|
|
const {
|
|
migrationSaveConfig,
|
|
loadLatestConfig,
|
|
} = require('../lib/new-settings-loader')
|
|
const { getMachineIds } = require('../lib/machine-loader')
|
|
|
|
exports.up = function (next) {
|
|
var sql = [
|
|
`ALTER TABLE cash_out_actions
|
|
ADD COLUMN provisioned_3 INTEGER,
|
|
ADD COLUMN provisioned_4 INTEGER,
|
|
ADD COLUMN dispensed_3 INTEGER,
|
|
ADD COLUMN dispensed_4 INTEGER,
|
|
ADD COLUMN rejected_3 INTEGER,
|
|
ADD COLUMN rejected_4 INTEGER,
|
|
ADD COLUMN denomination_3 INTEGER,
|
|
ADD COLUMN denomination_4 INTEGER`,
|
|
`ALTER TABLE devices
|
|
ADD COLUMN cassette3 INTEGER NOT NULL DEFAULT 0,
|
|
ADD COLUMN cassette4 INTEGER NOT NULL DEFAULT 0,
|
|
ADD COLUMN number_of_cassettes INTEGER NOT NULL DEFAULT 2`,
|
|
`ALTER TABLE cash_out_txs
|
|
ADD COLUMN provisioned_3 INTEGER,
|
|
ADD COLUMN provisioned_4 INTEGER,
|
|
ADD COLUMN denomination_3 INTEGER,
|
|
ADD COLUMN denomination_4 INTEGER`,
|
|
]
|
|
|
|
return Promise.all([loadLatestConfig(), getMachineIds()]).then(
|
|
([config, machineIds]) => {
|
|
const newConfig = _.reduce(
|
|
(acc, value) => {
|
|
const deviceId = value.device_id
|
|
if (_.includes(`cashOut_${deviceId}_top`, _.keys(config))) {
|
|
acc[`cashOut_${deviceId}_cassette1`] =
|
|
config[`cashOut_${deviceId}_top`]
|
|
}
|
|
|
|
if (_.includes(`cashOut_${deviceId}_bottom`, _.keys(config))) {
|
|
acc[`cashOut_${deviceId}_cassette2`] =
|
|
config[`cashOut_${deviceId}_bottom`]
|
|
}
|
|
|
|
return acc
|
|
},
|
|
{},
|
|
machineIds,
|
|
)
|
|
|
|
return migrationSaveConfig(newConfig).then(() => db.multi(sql, next))
|
|
},
|
|
)
|
|
}
|
|
|
|
exports.down = function (next) {
|
|
next()
|
|
}
|