Calculate door lock charges

This commit is contained in:
Senad Uka
2019-06-14 17:41:09 +02:00
parent 8e4eb0cf1f
commit 393e9b8aec
37 changed files with 1736 additions and 66 deletions

View File

@@ -0,0 +1,35 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.removeColumn('unscheduledIncidents', 'chargeType'),
queryInterface.addColumn('unscheduledIncidents', 'chargePrice', {
type: Sequelize.FLOAT,
after: 'doorLockEventTimestamp'
}),
queryInterface.addColumn('unscheduledIncidents', 'timeIntervalsToCharge', {
type: Sequelize.INTEGER,
after: 'chargePrice'
}),
queryInterface.renameColumn('unscheduledIncidents', 'chargeFee', 'totalChargeFee')
]);
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.renameColumn('unscheduledIncidents', 'totalChargeFee', 'chargeFee'),
queryInterface.removeColumn('unscheduledIncidents', 'timeIntervalsToCharge'),
queryInterface.removeColumn('unscheduledIncidents', 'chargePrice'),
queryInterface.addColumn('unscheduledIncidents', 'chargeType', {
type: Sequelize.ENUM,
values: ['unlocked', 'unscheduled'],
after: 'doorLockEventTimestamp'
}),
]);
});
}
};