Hi.
I would like to delete ALL topics from a single category (~5000 topics) in order to re-import these topics from phpbb.
I could delete these topics, but since Discourse doesn’t really delete them but hide them, my phpbb import won’t re-import these messages.
I can’t just re-import from scratch either because I did a lot of configuration since my import. Not only discourse admin config but also reorganized categories, moved hundreds of topics by keywords, filtered a lot of messages with regexes to remove some content, edited some users and so on.
I was suggested a rails command. Note that my forum isn’t active opened to my community yet. I imported phpbb messages but no users logged in or posted on the forum. I hope that may minimize the probability that something is broken after the deletion.
Would:
Topic.where(category_id: XX).destroy_all
do the trick?
Do you think there some database tables that should be cleaned up in some way after this?
I’m not sure – this might also be performance intensive depending on how many weirdo Rails ActiveRecord things this causes to cascade through. Any thoughts @neil have you ever done this?
Hi,
I’ve done this without setting a limit and it properly removed all the 5000 topics, but it didn’t seem to destroy all the posts from these topics as the posts table still had the same number of records.
Plus, maybe there is a lot of related data in other table to take care of?
Do you see any table which can contain potentially annoying residual data or do you think that would do the trick and it would be a safe enough method to definitively destroy my topics?