summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/cleanup17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/cleanup b/bin/cleanup
index e2776bb7..a25a8320 100755
--- a/bin/cleanup
+++ b/bin/cleanup
@@ -50,6 +50,23 @@ async function cleanup() {
}
}
})
+ await models.Revision.findAll({
+ include: [{
+ model: models.Note,
+ as: 'note'
+ }]
+ }).then(async function(revisions) {
+ for(let i =0, revisionCount = revisions.length; i< revisionCount; i++) {
+ const item = revisions[i]
+ if(item.noteId != null && !item.note) {
+ await models.Revision.destroy({
+ where: {
+ id: item.id
+ }})
+ logger.info(`Deleted revision ${item.id} from note ${item.userId}`)
+ }
+ }
+ })
process.exit(0)
}