Rebuild User Actions

Is there a way to rebuild user actions? I have done an import using the bulk importer, and this processes likes by importing them into the post_actions table, but users still show no likes in the Activity->Likes section of the user profile. I think likes need entries in the user_actions table as well. This table only has actions for NEW_TOPIC and REPLY after the import.

Is there maybe a rake task to rebuild user actions that will include relevant post actions or is this something that would need to be imported directly up front?



I noticed you removed the rake command to rebuild user actions here: NoMethodError When Rebuilding User Actions - #3 by sam

However in the same topic you suggested people look at the normal importers at the time for guidance. What do you think we should do for the bulk importer?


Honestly I am not sure, maybe @zogstrip knows. My guess is that you need to do nothing.

The rake task was seriously broken, hence the removal.


Our most rest import test. By the way, bulk importing is magical.

Likes show up everyone correctly, including in profile stats, posts, PMs, etc. but not in user activity or the about stats page. The two that show up we’re just ones I did after the fact.

I’ll wait to see what @zogstrip can chime in if possible. Would be nice to get likes working completely.

1 Like

No idea about any existing rake task, but months ago when we imported vB3 to Discourse we wrote custom code to import all the likes from our legacy vB “thank you” plugin.

Some of our custom code for this is documented here:

If I knew then what I know now I would have written a custom rake task back then…


This was my suspicion. Both tables need to be populated during the import. Thanks for the reference!


My pleasure to help a brother cyber-immigrant :slight_smile:

Glad you found the chronicles of my “thanks to likes” migration useful!

Happy New Year

1 Like

Did you run the import:ensure_consistency rake task after the bulk import?

1 Like

Yes. It seems after that plus some of the regular sidekiq jobs, the post actions were accounted for correctly, but the user action side of that coin was not.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.