diff --git a/backend/migrations/20240926141934-renameManagerJobRole.js b/backend/migrations/20240926141934-renameManagerJobRole.js new file mode 100644 index 0000000000..23e92c1176 --- /dev/null +++ b/backend/migrations/20240926141934-renameManagerJobRole.js @@ -0,0 +1,46 @@ +'use strict'; + +const models = require('../server/models/index'); + +const jobs = [ + { id: 14, newTitle: 'Manager (care-related, but not care-providing)', oldTitle: 'Managers and staff (care-related, but not care-providing)' }, +] + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + return queryInterface.sequelize.transaction(async (transaction) => { + for (const job of jobs) { + await models.job.update( + { + title: job.newTitle + }, + { + where: { + id: job.id, + }, + transaction, + }, + ); + } + }); + }, + + async down (queryInterface, Sequelize) { + return queryInterface.sequelize.transaction(async (transaction) => { + for (const job of jobs) { + await models.job.update( + { + title: job.oldTitle + }, + { + where: { + id: job.id, + }, + transaction, + }, + ); + } + }); + } +};