I’m getting an “Invalid property name for class” error during migration.
The gist of it is as follows:
- I start with a model, let’s call it Story.
- In a migration, I create a new model using migration.create. Let’s call this new model Book. Book has a field which contains a list of Story objects mentioned in 1.
- In a subsequent migration, I add a field to the Story model. Let’s call this new field “author”.
When I run a migration, I get a RLMException: “Invalid property name ‘author’ for class ‘Story’”. The RLMException happens in the migration in step 2 (in the migration.create call).
I’ve posted the issue here in more detail with code: https://stackoverflow.com/questions/56398431/realm-how-to-fix-invalid-property-name-rlmexception-during-migration
I don’t know if I fully understand the cause (much less how to fix it), but my guess is that when the Book model is created, Realm sees the ‘author’ field in the Story class, however, this field isn’t introduced until a subsequent migration.
Any help or insight into the issue would be greatly appreciated.