# Il modo corretto per eliminare completamente centinaia di argomenti tramite Rails?

**URL:** <https://meta.discourse.org/t/the-proper-way-to-completely-delete-hundred-of-topics-via-rails/90323>\
**Category:** Product Support\
**Created:** [20 Giugno 2018, 3:52pm UTC](https://meta.discourse.org/t/the-proper-way-to-completely-delete-hundred-of-topics-via-rails/90323 "2018-06-20T15:52:40Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [20 Giugno 2018, 3:52pm UTC](https://meta.discourse.org/t/the-proper-way-to-completely-delete-hundred-of-topics-via-rails/90323/1 "2018-06-20T15:52:40Z")

</div>

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:

```ruby
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?

Any idea, advice suggestion to achieve this?

---

_[View the full topic](https://meta.discourse.org/t/the-proper-way-to-completely-delete-hundred-of-topics-via-rails/90323)._
