Completely deleting previous versions of a post or message

Hi, it seems that feature merged is not the similar that title contains. With data explorer I found that some version of certain wiki topic had a big attachment which I’d like to destroy.

Just want to say how to delete an attachment from version the post on self-hosted instances. Unfortunately method from Search attachments by storage name cannot be applied in this case (unable to get sha1 from filename).

First find sha1 using SQL:

sudo /var/discourse/launcher enter app
su - discourse
psql
SELECT filesize, original_filename, sha1 FROM uploads WHERE filesize > 3000000 order BY filesize desc;

then you get sha1. Next, close the connection to db, exit from user to root and open rails command line:

ctrl+d
ctrl+d
rails c
pry(main)> Upload.find_by(sha1: '<sha1>')

Finally you get url of the attachment pointing to the filesystem location. The question of the topic is still opened.