37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
const transaction = await queryInterface.sequelize.transaction();
|
|
try {
|
|
await queryInterface.addColumn('yearly_leave_summaries', 'opening_balance', {
|
|
type: Sequelize.DataTypes.DECIMAL,
|
|
allowNull: true,
|
|
defaultValue: 0,
|
|
}, { transaction });
|
|
|
|
await queryInterface.addColumn('yearly_leave_summaries', 'ending_balance', {
|
|
type: Sequelize.DataTypes.DECIMAL,
|
|
allowNull: true,
|
|
defaultValue: 0,
|
|
}, { transaction });
|
|
|
|
await transaction.commit();
|
|
} catch (err) {
|
|
await transaction.rollback();
|
|
throw err;
|
|
}
|
|
},
|
|
|
|
async down(queryInterface, Sequelize) {
|
|
const transaction = await queryInterface.sequelize.transaction();
|
|
try {
|
|
await queryInterface.removeColumn('yearly_leave_summaries', 'opening_balance', { transaction });
|
|
await queryInterface.removeColumn('yearly_leave_summaries', 'ending_balance', { transaction });
|
|
await transaction.commit();
|
|
} catch (err) {
|
|
await transaction.rollback();
|
|
throw err;
|
|
}
|
|
}
|
|
};
|