I need to add @PrimaryKey to two Realm models that are missing due to idiocy. Models are mentioned in several other models through direct relationships or RealmLists, one of the two models also refers to the other model.
My first thought was to rename the schemas in the transfer and copy the data manually, but then Realm complains that the schema is connected in other schemas and cannot be renamed.
Both schemes contain about 15,000 objects that can be compressed to about 100, they are absolutely identical and duplicated due to the lack of @PrimaryKey .
The models themselves are simple:
class ModelA extends RealmObject { String primaryKey;
How can I transfer data when I add @PrimaryKey to the " primaryKey " field for both classes?
Edit to clarify:
Both circuits contain several completely identical elements.
primaryKey | someField | someOtherField ------ | ------ | ------ A | foo | bar A | foo | bar A | foo | bar A | foo | bar B | bar | foo B | bar | foo B | bar | foo C | far | boo C | far | boo C | far | boo
These duplicates can be removed since primaryKey uniquely identifies them. When I add the @PrimaryKey annotation and do the migration, Realm explicitly complains about duplicate values. I need to remove these duplicates without destroying the links in other models.
source share