| 1234567891011121314151617181920212223242526 |
- module.exports = {
- version: 1.04,
- name: 'Labor Hours',
- description: 'Adds an hours field to labor and workday, moves previously separated hours into that field.',
- up: async (queryInterface, Sequelize) => {
- await queryInterface.addColumn('labors', 'hours', Sequelize.DOUBLE)
- await queryInterface.addColumn('workdays', 'hours', Sequelize.DOUBLE)
- await queryInterface.addColumn('labors', 'doubletimeHours', Sequelize.DOUBLE)
- await queryInterface.addColumn('workdays', 'doubletimeHours', Sequelize.DOUBLE)
- await queryInterface.sequelize.query(`
- UPDATE labors
- SET hours = COALESCE(overtimeHours, 0) + COALESCE(regularHours, 0),
- overtimeHours = null,
- regularHours = null
- WHERE hours is null
- `)
- await queryInterface.sequelize.query(`
- UPDATE workdays
- SET hours = COALESCE(overtimeHours, 0) + COALESCE(regularHours, 0),
- overtimeHours = null,
- regularHours = null
- WHERE hours is null
- `)
- return 1.04
- }
- }
|