If it’s not too late (your forum has not yet gone live and people are not yet adding new data), your want to do that in your import script. Just wipe the database and start again.
If it is too late (you’ve already launched your forum in discourse) you’ll want to do it in rails. It’s too hard to do it in a take task because of figuring out all the layers of escaping special characters.