21 lines
662 B
JavaScript
21 lines
662 B
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
const tableDesc = await queryInterface.describeTable('Timers').catch(() => null);
|
|
if (!tableDesc) return;
|
|
|
|
const addIfMissing = async (col, def) => {
|
|
if (!tableDesc[col]) await queryInterface.addColumn('Timers', col, def);
|
|
};
|
|
|
|
await addIfMissing('timerMode', { type: Sequelize.STRING });
|
|
await addIfMissing('workoutDate', { type: Sequelize.DATEONLY });
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
await queryInterface.removeColumn('Timers', 'timerMode').catch(() => {});
|
|
await queryInterface.removeColumn('Timers', 'workoutDate').catch(() => {});
|
|
},
|
|
};
|