Reputation: 6073
We're trying to migrate Realm from 1.x to a 2.x version. Do we need to provide migration in this case? We would like to keep the data obviously, but I think Realm deletes it if you update the app now. We havent released the 2.x version yet so now we need to deal with migration.
Upvotes: 0
Views: 134
Reputation: 216
The Realm should be migrated automatically to the new format going from 1.x to 2.x since the file format changed.
https://blog.realm.io/realm-java-2-0-mobile-platform-support/
Upvotes: 1
Reputation: 3007
What behavior have you experienced when upgrading from 1.x to 2.x on a test device?
If you have deletedRealmIfMigrationNeeded()
set on your RealmConfiguration
then it will delete the data. You will need remove that line from your RealmConfiguration
and add a migration(YourMigration.class)
I would recommend a lot of testing for this changing, and ensure you add all past database changes the migration.
See here for information on how to do a migration: https://realm.io/docs/java/latest/#migrations
Upvotes: 0