Permanent deletion: Is there a database command?

With this function, postings/threads can be permanently removed from the database. Depending on the number of deleted postings/threads, however, this can be very time-consuming. Is there a command/script for the database or rails to automate the process?

If your wish is to hard-delete all the soft-deleted posts, then you could loop through them with a rails script and use the destroy method.

That might give some info:


I was hoping for a ready-made command that has already been tested. I would not like to start experimenting on a productive platform. :wink:

1 Like

It’s always prudent to have a testing or staging site rather than experiment on production :wink:


Any irreversible operation involving batches is extremely dangerous. I highly recommend that you back it up first, and then write code in a test environment. :wink:

I don’t think anyone should dare to guarantee that “my code will permanently delete thousands of posts at a time, and it will never go wrong!”