-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ER-1242 📜 - Adding changeScripts for the changing communication messa…
…ges statuses +semver: patch
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...ecruit.ChangeScripts/010-communicationMessages_updateStatusFromFailedDeliveryToNotSent.js
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,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'."); | ||
} |
18 changes: 18 additions & 0 deletions
18
src/Data/Recruit.ChangeScripts/020-communicationMessages_updateStatusFromUnsentToPending.js
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,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'."); | ||
} |