In Realm on Android, How do you migrate (add) a new linking field

Viewed 699

Ok so i have an app than had a Coin realm object. I am now upgrading my app, and adding multiple new fields to the existing Coin object. So far so good, but how do i migrate a LinkingObject, RealmResults type. linkedPortfolioCoins is what i want to migrate

public class Coin extends RealmObject {
    //a bunch of other fields here

    @LinkingObjects("coin")
    private final RealmResults<PortfolioCoin> linkedPortfolioCoins = null;
}

Also, There is only

.addRealmListField

Which i assume will be ok instead of RealmResults, but how do i make it a LinkingObject to Coin.

The error im getting is

 Caused by: io.realm.exceptions.RealmMigrationNeededException: Field count is more than expected - expected 18 but was 19
1 Answers
Related