I am trying out SwiftData schema migration to see what is possible.
I understand from the WWDC23 sessions that I can
rename properties (as an example of a lightweight migration) and
make properties unique (as an example of a custom migration)
This has worked well and promising.
But I have tried unsuccessfully to add a new property to an existing model, resulting in fatal errors, like
Fatal error: Expected only Arrays for Relationships
Also, I failed adding a new Model to an existing schema with different fatal errors depending on my try-and-error coding.
Questions
In a migration stage, I have access to a model context. How does this reflect the old and new schema? For example if I rename a model, will I have access to both the old and new model?
Are there any examples of doing complex migrations yet?
What are the currently supported migration operations besides making an attribute unique and renaming an attribute?
Any pointer to a more in-depth documentation will be appreciated.