android - Manually add @Required to the primary field to maintain the same behavior as 0.88.3 (upgrade to 0.89.0) -


i updated realm 0.88.3 0.89.0. in changelog says

primarykey fields no longer automatically marked @required. can null if type of field can null. change throw realmmigrationneededexception. either manually add @required primary field maintain same behavior 0.88.3 , below, or change nullability in migration step.

what tried:

1. add @required object throws "error:(542, 114) error: incompatible types: string cannot converted long"

public class migration{    .    .    .     schema.get("retailer")       .setrequired("id", true);    .    . }  @realmclass public class retailer extends realmobject {      @primarykey @required     private string id;     .     .     . } 

how correct?

thanks beeender, updated newer version 0.89.1 , working now.

just add @required existing primary key , no migration needed.

@realmclass public class retailer extends realmobject {      @primarykey @required     private string id; } 

if add new realmobject project have write following migration:

schema.create("retailer")     .addfield("id", string.class, fieldattribute.primary_key, fieldattribute.required) 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -