migrateMessagesToChatIds

Migrates all historical messages so that each message's chat value follows the modern conversation ID format.

Steps performed:

  • Loads all messages

  • Groups them by legacy chat name

  • Determines correct UUID association for each chat group

  • Generates a conversation ID using local + remote UUIDs

  • Rewrites messages with updated chat names

Errors are logged but do not stop the migration process.