Realm Migration: Non-default realms needed to be migrated on default realm migration again

There are two realm configurations on my app. One as default and the other for other uses. The default configuration(as from the documentation, it automatically creates a default.realm):

config = new RealmConfiguration.Builder()




and the normal realm configuration is:

normalConfig = new RealmConfiguration.Builder()





the normal_realm contains a Realm table "Student", which has two fields 'name'. so, adding another field 'age' would require the migration for normal_realm is,

private static RealmMigration myMigration = new RealmMigration() {


public void migrate(DynamicRealm realm, long oldVersion, long newVersion) {

RealmSchema schema = realm.getSchema();

if (oldVersion == 0) {



if (oldVersion == 2) {

if (!schema.get(Student.class.getSimpleName()).hasField("age")) {


Read More »

By: StackOverFlow - Tuesday, 13 March

Related Posts