Summary
Is it possible to delete posts to get back under the 10,000 message limit in the Team edition?
Observed behavior
I had an automated webhook that went wild and sent about 40,000 messages in the span of a couple hours, which caused me to hit the 10,000 message limit and now I can’t see any posts older than today in any channel. I ran a command in my Postgres DB to mark the messages as deleted, but I haven’t actually removed any entries because I’m afraid of causing instability if I do. And so far, doing so doesn’t appear to have restored my past messages. Is there a safe way to do it, and would it actually restore my other messages? Or delete and recreate the channel? Here’s the command I ran:
UPDATE posts SET deleteat = (EXTRACT(EPOCH FROM NOW()) * 1000) WHERE channelid = 'Automation_Channel_ID' AND deleteat = 0;
I tried the SQL command from my original post and waited a long time for built-in garbage collection to do it’s thing, but no luck. I ended up deleting all of the posts in that channel:
DELETE FROM posts WHERE channelid = 'Automation_Channel_ID';
If you’re familiar with SQL, you can customize the above command with a WHERE clause to further limit the chat record deletions.
The iOS app is still not displaying old messages, even after removing all app data and logging out and back in. But I can confirm the desktop app is now displaying messages again. If it doesn’t return soon, I’ll try wiping the app from my phone and reinstalling it. EDIT: “Reinstalling worked! Finally have all my old messages.”
I also ran the following commands before checking the desktop app - not sure if it was required or not:
UPDATE channels SET totalmsgcount = 0 WHERE id = 'Automation_Channel_ID';
UPDATE channels SET totalmsgcountroot = 0 WHERE id = 'Automation_Channel_ID';
So far, I haven’t noticed any side effects, but your mileage may vary. Hope this helps someone in the future!