diff --git a/src/database/migrations/20240219103552-update-mentor-session-reschedule.js b/src/database/migrations/20240219103552-update-mentor-session-reschedule.js new file mode 100644 index 000000000..773269fea --- /dev/null +++ b/src/database/migrations/20240219103552-update-mentor-session-reschedule.js @@ -0,0 +1,37 @@ +'use strict' + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId + if (!defaultOrgId) { + throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.') + } + // update the body correct the end date and time + let updateData = { + body: '
Dear {name},
Please note that the Mentor has rescheduled the session - {sessionTitle} from {oldStartDate} {oldStartTime} - {oldEndDate} {oldEndTime} to {newStartDate} {newStartTime} - {newEndDate} {newEndTime} Please make note of the changes.', + } + let updateFilter = { + code: 'mentor_session_reschedule', + organization_id: defaultOrgId, + } + // Update operation + let check = await queryInterface.bulkUpdate('notification_templates', updateData, updateFilter) + }, + + async down(queryInterface, Sequelize) { + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId + if (!defaultOrgId) { + throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.') + } + let updateData = { + body: 'Dear {name},
Please note that the Mentor has rescheduled the session - {sessionTitle} from {oldStartDate} {oldStartTime} - {oldEndDate} {oldEndTime} to {newStartDate} {newStartTime} - {newStartDate} {newStartTime} Please make note of the changes.', + } + let updateFilter = { + code: 'mentor_session_reschedule', + organization_id: defaultOrgId, + } + // Update operation + let check = await queryInterface.bulkUpdate('notification_templates', updateData, updateFilter) + }, +}