-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6370 from NMDSdevopsServiceAdm/fix/1519-job-roles…
…-snagging-list added missing migration
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
}, | ||
); | ||
} | ||
}); | ||
} | ||
}; |