@Test public void ProperlyMigrateGlucoseFromVersion4() { when(objectMock.getInt("reading")).thenReturn(8); migration.migrate(realmMock, 4, 5); inOrder.verify(schemaMock).get("GlucoseReading"); checkObjectIntMigration("reading", 8); }
@Override public void migrate(@NonNull DynamicRealm realm, long oldVersion, long newVersion) { RealmSchema schema = realm.getSchema(); if (oldVersion == 0) { createInitialSchema(schema); oldVersion++; } if (oldVersion == 1) { changeHB1ACReadingsToDouble(schema); oldVersion++; } if (oldVersion == 2) { addWeightAndA1CUnitsToUser(schema); oldVersion++; } if (oldVersion == 3) { addReminders(schema); oldVersion++; } if (oldVersion == 4) { migrateAllReadingsToDouble(schema); oldVersion++; } }
Migration implements RealmMigration { @Override public void migrate(@NonNull DynamicRealm realm, long oldVersion, long newVersion) { RealmSchema schema = realm.getSchema(); if (oldVersion == 0) { createInitialSchema(schema); oldVersion++; } if (oldVersion == 1) { changeHB1ACReadingsToDouble(schema); oldVersion++; } if (oldVersion == 2) { addWeightAndA1CUnitsToUser(schema); oldVersion++; } if (oldVersion == 3) { addReminders(schema); oldVersion++; } if (oldVersion == 4) { migrateAllReadingsToDouble(schema); oldVersion++; } } }
Migration implements RealmMigration { @Override public void migrate(@NonNull DynamicRealm realm, long oldVersion, long newVersion) { RealmSchema schema = realm.getSchema(); if (oldVersion == 0) { createInitialSchema(schema); oldVersion++; } if (oldVersion == 1) { changeHB1ACReadingsToDouble(schema); oldVersion++; } if (oldVersion == 2) { addWeightAndA1CUnitsToUser(schema); oldVersion++; } if (oldVersion == 3) { addReminders(schema); oldVersion++; } if (oldVersion == 4) { migrateAllReadingsToDouble(schema); oldVersion++; } }  }
Migration implements RealmMigration { @Override public void migrate(@NonNull DynamicRealm realm, long oldVersion, long newVersion) { RealmSchema schema = realm.getSchema(); if (oldVersion == 0) { createInitialSchema(schema); oldVersion++; } if (oldVersion == 1) { changeHB1ACReadingsToDouble(schema); oldVersion++; } if (oldVersion == 2) { addWeightAndA1CUnitsToUser(schema); oldVersion++; } if (oldVersion == 3) { addReminders(schema); oldVersion++; } if (oldVersion == 4) { migrateAllReadingsToDouble(schema); oldVersion++; } }  @Override void migrate(@NonNull DynamicRealm realm, long oldVersion, long newVersion); }
Migration implements RealmMigration { @Override public void migrate(@NonNull DynamicRealm realm, long oldVersion, long newVersion) { RealmSchema schema = realm.getSchema(); if (oldVersion == 0) { createInitialSchema(schema); oldVersion++; } if (oldVersion == 1) { changeHB1ACReadingsToDouble(schema); oldVersion++; } if (oldVersion == 2) { addWeightAndA1CUnitsToUser(schema); oldVersion++; } if (oldVersion == 3) { addReminders(schema); oldVersion++; } if (oldVersion == 4) { migrateAllReadingsToDouble(schema); oldVersion++; } }  @Override void migrate(@NonNull DynamicRealm realm, long oldVersion, long newVersion);  }