Posts and topics not counted after migration

AI-generated summary

After migrating from NodeBB to Discourse using the provided guide, nino1904 noticed that user post counts were not being accurately reflected, despite all posts appearing in the system. pfaffman suggested running the rake import:ensure_consistency task to resolve the issue. nino1904 reported that post counts eventually appeared but were inflated, with some users showing nearly double the expected number of posts. pfaffman hypothesized that this discrepancy might be due to Discourse counting private messages as posts, a feature not present in NodeBB. nino1904 confirmed that private messages were not imported, but questioned why Discourse would count them as posts. pfaffman acknowledged the uncertainty, noting that both regular and private messages are stored in the same posts table, but it’s unclear if the post count includes both types.

Hey guys,

after migrating from NodeBB with help of this guide using the NodeBB migration script everything looks good - all the categories, topics, posts etc. are there.

But I’ve noticed that every user has zero posts counted by Discourse. A user for example has 500 likes but 0 posts in the users overview. As all the posts are there, is there maybe a function to get the post count updated?

On the other hand, on a users profile the topics and posts in top categories are counted:

I think a task runs that will fix that soon. You might also try

rake import:ensure_consistency

@nino1904 were you able to resolve your issue?

I could say yes but I would like to try another migration. I’ve tried a few things that day and suddenly the post counts were there - but way too many. For example in NodeBB a user has like 1.5k posts, in Discourse the user has 2.8k posts.

Could discourse be importing deleted posts? That’s a big difference, though.

Another possibility is that Discourse counts pms and public posts and the other system counts them separately.

Good point, NodeBB does not count private messages. But private messages are not getting imported so not sure about that. By the way, why does Discourse count private messages as posts?

I’m not 100% sure that it does, but they are on the same posts table. I don’t know if the post count you’re looking at counts just the regular posts or all of them.