Delete all posts containing a string (mysql)

I’m trying to delete all posts from a specific channel that contain a specific string. I’ve identified the select statement that I need to find all the posts within the channel that contain the string.

I’m just wondering if it’s as easy as doing a DELETE instead of a SELECT or is there more to it than that?

Here is the select statement:
select * from Posts where ChannelId=‘akixfyrzxj89idfq4jaaiukb4h’ AND Message LIKE ‘%Uknown trap%’;

Can anyone confirm that this will work as expected or are there other tables/rows that need to be considered before deleting?

Brad

Hello, @bfitzelle

The process of deleting posts in Mattermost should only involve the Posts table. So, if you are certain that you are going to delete posts that contain that string:

%Uknown trap%

Verify the SQL SELECT statement returns the posts that you intend to completely purge from the system before you run the DELETE statement.