In a recent post, I demonstrated how to migrate your Realm data when you upgraded your iOS app with a new schema. But, that only handled the data in your local, standalone Realm database. What if you’re using MongoDB Realm Sync to replicate your local Realm data with other instances of your mobile app and with MongoDB Atlas?
I’ve just released a follow-on post — Migrating Your iOS App’s Synced Realm Schema in Production — that steps through how to migrate a synced Realm schema.
I start with the original RChat app. I then extend the iOS app and backend Realm schema to add a new feature that allows chat messages to be tagged as high priority. The next (and perhaps surprisingly more complicated from a Realm perspective) upgrade is to make the author attribute of the existing ChatMessage object non-optional.