realm-java
realm-java copied to clipboard
Migration .addField how to set a default boolean to true?
class Account {
isActive = true;
}
if (oldVersion == 3) {
schema.get("Account")
.addField("isActive", boolean.class);
oldVersion++;
}
This is code for migrating my schema were I have added a isActive field that should be defaulted to true.
But after migration isActive is false. Is there a way to set the value to true by default ?
.transform(new RealmObjectSchema.Function() { @Override public void apply(DynamicRealmObject obj) { obj.set("isActive", true); } });
closed