Delete deleted-posts permanently in bulk?

Sorry if that’s a stupid question …
Why with Discourse it is not possible to easily delete messages from the database?

1 Like

Discourse uses a mechanism called a ‘soft delete’ which makes it easy to correct mistakes. It also allows to make a difference between ‘deleted for other users’ and ‘deleted for admins’.

It also maintains database integrity. What if a deleted post was quoted (before it was deleted) ? Then the quoting post has a reference to a post that does not exist any more. That could lead to all kinds of errors.

1 Like

Thanks now i understand… the only problem is if there are a lot of deleted messages.

It’s been discussed and requested before, more than once e.g.

While I understand that soft-delete maybe useful, after some period (e.g. 1 week or month) it would be nice if deleted things were actually removed to save space and also ensure legal compliance e.g because some thing illegal was posted, or personal details need removing for GDPR compliance.

Having to log on and run a rake task to replace the message with ‘this has been deleted’ is a bit naff.

1 Like

Opss… sorry, coming from phpBB I thought it could be done.

its now implemented

4 Likes

Best,

But how we do that ???

I’ve been playing with that this morning, and I can’t figure it out. :slightly_smiling_face: Any pointers?

well, the setting needs to be set in admin > settings > security (currently hidden for some reason) and then each admin would need it to be granted like moderator.

Once Granted, it would appear in the post admin menu

2 Likes

Ah, that might be my stumbling block. I was looking for can_permanently_delete in the admin settings and couldn’t see it.

The site setting is hidden because we do not encourage its use. That was developed for the cases when some sensitive information was posted and it must be scrubbed from the database completely. One more thing, that operation is not a bulk operation anyway.

Since it is a hidden site setting, the only way to enable it is from the console.

4 Likes

This is almost exactly what I need! Thank you.

How would I do the syntax so that it only covers all posts deleted before xxxx date?

That would be Post.with_deleted.where("deleted_at < 'YYYY-mm-dd'").update_all(...)

4 Likes