Files
vitfit-r2/V2/app/modules/users/migrations/014-users-password-changed-at.js
T
2026-06-13 08:03:45 -04:00

21 lines
677 B
JavaScript

'use strict';
// passwordChangedAt was added in 003 for new installs; this migration ensures
// it exists on V1 upgrades where 003 ran the addIfMissing path but may have
// been using an older column list.
module.exports = {
async up(queryInterface, Sequelize) {
const tableDesc = await queryInterface.describeTable('Users').catch(() => null);
if (tableDesc && !tableDesc['passwordChangedAt']) {
await queryInterface.addColumn('Users', 'passwordChangedAt', {
type: Sequelize.DATE,
allowNull: true,
});
}
},
async down(queryInterface) {
await queryInterface.removeColumn('Users', 'passwordChangedAt').catch(() => {});
},
};