Files
vitfit-r2/V2/app/modules/timers/migrations/019-timers-timermode.js
T
2026-06-30 11:49:26 -04:00

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(() => {});
},
};