Is there a way to remove all post revisions from all the posts?

I’ve been editing posts on my board, mainly in order to fix weird post formating after importing the old database and also to convert links to oneboxes – it needed a little work, but it’s done now.

The problem is that many posts now have 2-5 revisions, which makes the database larger. The posts revisions could be safely removed because I obviously don’t need them, at least these ones.

So is there a way to remove all the post revisions somehow?

I would not worry about that.

An image would be worth 100s (if not 1000s) of post revisions storage-wise.


Hmm, but is there a way to remove them all? I’m just curious :smiley:

If you know SQL, then it’s two queries away

  • delete everything in the post_revisions table
  • update version and public_version on the posts table to 1



I think that’s the solution I’ve been looking for. :slight_smile: I’ll test how it works and see whether it’s worth doing.

Ok, so it would be something like this, right?

discourse-# \connect discourse
discourse=# delete from post_revisions *;
discourse=# update posts set public_version=1 where public_version>1;
discourse=# update posts set version=1 where version>1;