diff --git a/src/upgrades/1.9.0/refresh_post_upload_associations.js b/src/upgrades/1.9.0/refresh_post_upload_associations.js new file mode 100644 index 0000000000..e176835940 --- /dev/null +++ b/src/upgrades/1.9.0/refresh_post_upload_associations.js @@ -0,0 +1,21 @@ +'use strict'; + +var async = require('async'); +var posts = require('../../posts'); + +module.exports = { + name: 'Refresh post-upload associations', + timestamp: Date.UTC(2018, 3, 16), + method: function (callback) { + var progress = this.progress; + + require('../../batch').processSortedSet('posts:pid', function (pids, next) { + async.each(pids, function (pid, next) { + posts.uploads.sync(pid, next); + progress.incr(); + }, next); + }, { + progress: this.progress, + }, callback); + }, +};