A few questions about batch moving or deleting topics

Hi. I’ve imported data from a phpbb and I’m reworking all the categories.

How do I move or delete all the topics from:

  1. One category (well I’m aware of Topic.where(category_id: XX).update_all(category_id: YY) but I don’t know how to delete topics this way)?
  2. Multiples categories?
  3. All the subcategories from a target parent category?

Thank you.

I usually create an array with the category ID that I don’t want and modify the category importer to skip those categories and makes sure that the topic importer skips topics if the category doesn’t exist.

1 Like

Hi, thank you for your reply.

Which file(s) should I modify? Is such a modification quick and straightforward or does it need work to be functional?

If I can avoid re-importing my forum I’d prefer though.

Also, I noticed that after moving some posts with Topic.where(category_id: XX).update_all(category_id: YY) the number of messages was not updated and it seems that it couldn’t be either from sidekiq tasks. Also, it moved the “about this category” topic which can’t be deleted.

I guess this is a more proper way to do so: https://meta.discourse.org/t/best-way-to-combine-merge-categories-when-importing-topics/21353/6 but it doesn’t tell me how to properly delete all messages from a category, just how to move them.

Solutions are to be found here :+1::


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