We have now seen that the SyncEngine
perfectly handles the situation where multiple apps are running different schemas. A device running the newest version of the app can create and edit records, and that data will be synchronized to devices running an old version of the app, even if those versions have no idea how to handle the data being sent to it.
It’s amazing to see that SQLiteData takes special care of your data to make sure that apps running different versions of your schema can communicate with each other without losing data. And best of all, it’s completely seamless. You don’t have to think about it as a user of SQLiteData. You can just rest assured that your user’s data is synchronized across all of their devices, regardless of what version of your app they are running.
But let’s push this further. Let’s add a feature that requires a whole new table. In some ways this kind of schema drift seems simpler because we don’t have to worry about apps with different versions of the schema editing the same record.
But it is still subtly tricky. When the sync engine on the device with the old schema receives records for tables it doesn’t recognize, it can’t just silently discard that data. The sync engine will only receive that data once. It won’t magically get the data again once the app is updated and is running on the new schema. And so it has to take extra care to save that data for later so that when the app is upgraded and has access to the new tables, it can retry inserting all that data into the tables.
To explore this we are going to add a feature to our app that allows associating a cover image to reminders lists as a way of personalizing things a bit. This will also give us a chance to show off how the sync engine automatically handles assets for us behind the scenes without us having to think about it.
Let’s get started