Realm Kotlin SDK and Android app releases: making a schema version bump reversible after migration
0 reputation · 02 Feb 2024, 22:02 UTC
0 reputation · 02 Feb 2024, 22:02 UTC
I am integrating the Realm Kotlin SDK into an Android application where each release may bump the Realm schema version and run a Migration callback that adds or transforms fields. The documented behavior is that once the local .realm file is migrated to the higher version, the change is one-way: shipping a hotfix that reverts the schema version in code causes the older build to fail opening the already-migrated file.
The two components at the boundary are the Realm file on device and the app update/rollback pipeline (e.g., staged rollout plus the ability to reinstall a previous APK). The uncertainty is how to design the release process so that rolling back the app binary does not strand users on an unreadable database, given that Realm offers no built-in downgrade path and deleteRealmIfMigrationNeeded() would wipe local data.
Specifically:
Assuming a recent Realm Kotlin SDK 1.x release; verification against the exact version in use is still needed.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.