diff --git a/src/Data/Recruit.ChangeScripts/010-communicationMessages_updateStatusFromFailedDeliveryToNotSent.js b/src/Data/Recruit.ChangeScripts/010-communicationMessages_updateStatusFromFailedDeliveryToNotSent.js new file mode 100644 index 0000000000..ce5b0a4aed --- /dev/null +++ b/src/Data/Recruit.ChangeScripts/010-communicationMessages_updateStatusFromFailedDeliveryToNotSent.js @@ -0,0 +1,18 @@ +{ + print("Start updating communicationMessages collection documents which have a status of 'FailedDelivery' to 'NotSent'."); + + let writeResult = db.communicationMessages.updateMany({ + "status": "FailedDelivery" + }, { + "$set": { "status": "NotSent" } + }); + + if (writeResult.hasWriteConcernError()) { + printjson(writeResult.writeConcernError); + quit(14); + } + + print(`Found ${writeResult.matchedCount} communicationMessages with status 'FailedDelivery' of which ${writeResult.modifiedCount} have now been updated to have status 'NotSent'.`); + + print("Finished updating communicationMessages collection documents which have a status of 'FailedDelivery' to 'NotSent'."); +} \ No newline at end of file diff --git a/src/Data/Recruit.ChangeScripts/020-communicationMessages_updateStatusFromUnsentToPending.js b/src/Data/Recruit.ChangeScripts/020-communicationMessages_updateStatusFromUnsentToPending.js new file mode 100644 index 0000000000..9c4053277c --- /dev/null +++ b/src/Data/Recruit.ChangeScripts/020-communicationMessages_updateStatusFromUnsentToPending.js @@ -0,0 +1,18 @@ +{ + print("Start updating communicationMessages collection documents which have a status of 'Unsent' to 'Pending'."); + + let writeResult = db.communicationMessages.updateMany({ + "status": "Unsent" + }, { + "$set": { "status": "Pending" } + }); + + if (writeResult.hasWriteConcernError()) { + printjson(writeResult.writeConcernError); + quit(14); + } + + print(`Found ${writeResult.matchedCount} communicationMessages with status 'Unsent' of which ${writeResult.modifiedCount} have now been updated to have status 'Pending'.`); + + print("Finished updating communicationMessages collection documents which have a status of 'Unsent' to 'Pending'."); +} \ No newline at end of file