mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 16:06:08 +02:00
fix: old upgrade script
This commit is contained in:
@@ -14,15 +14,15 @@ module.exports = {
|
||||
progress.total = await db.sortedSetCard('topics:tid');
|
||||
await batch.processSortedSet('topics:tid', async (tids) => {
|
||||
progress.incr(tids.length);
|
||||
const topicData = await db.getObjectFields(
|
||||
const topicData = await db.getObjectsFields(
|
||||
tids.map(tid => `topic:${tid}`),
|
||||
['tid', 'cid', 'pinned', 'postcount'],
|
||||
);
|
||||
const bulkAdd = [];
|
||||
topicData.forEach((topic) => {
|
||||
if (topic && parseInt(topic.pinned, 10) !== 1) {
|
||||
topicData.postcount = parseInt(topicData.postcount, 10) || 0;
|
||||
bulkAdd.push([`cid:${topicData.cid}:tids:posts`, topicData.postcount, topicData.tid]);
|
||||
topic.postcount = parseInt(topic.postcount, 10) || 0;
|
||||
bulkAdd.push([`cid:${topic.cid}:tids:posts`, topic.postcount, topic.tid]);
|
||||
}
|
||||
});
|
||||
await db.sortedSetAddBulk(bulkAdd);
|
||||
|
||||
Reference in New Issue
Block a user