Can you bulk rebake chat messages?

I assume that you can (probably similarly to posts), just not sure how. We had an admin run a database edit on all chat messages by mistake trying to edit some in one channel, and now we need to rebake all affected chat messages (Which, unfortunately, seems to be all chat messages in all channels, including DMs)

1 Like

There is a

rake chat_messages:rebake_uncooked_chat_messages

So I guess you’d need to do something to un-mark them as cooked.

1 Like

Is there a way we could mark all of them as uncooked? (~99% of our chat messages need rebaked, so just hitting all of them is fine)

2 Likes
Chat::Message.update_all(cooked_version: nil)

I think that will do it, but I’m not making any promises that it won’t ruin your life.

2 Likes

Heh, can’t be that much worse than it already is.

Make sure to create a backup first!

1 Like

Out of curiosity, did that do the trick?

IIRC, I think what we ended up doing was:

  1. Run:
  1. Restore all messages we could from an older backup
  2. Rebake the rest
3 Likes