0

In my android project, we are using Realm db version 0.87.4. Currently Realm in version 2.3.1 for android.

Our android application already released in Playstore and many user using it. How to upgrade my realm db version without losing any data and functionalities.

I thought some Realm methods may be deprecated or removed from latest Realm Db

JEGADEESAN S
  • 566
  • 1
  • 6
  • 19

1 Answers1

1

Currently Realm db is in version 3.1.4 for Android. In order to migrate your database to the latest version,you have to change the RealmConfiguration code as follows

RealmConfiguration config = new RealmConfiguration.Builder()
                   .schemaVersion(1)
                   .migration(new MyMigration()) // Migration to run instead of throwing an exception
                   .build()

Assuming your schema is not changing, you also have to create the MyMigration class as follows,

public class MyMigration implements RealmMigration {
  @Override
   public void migrate(DynamicRealm realm, long oldVersion, long newVersion) {
   }
}

You may refer to Realm Docs for more info