Long time CoreData user here. Relatively new to SwiftData – but I’m loving how well it integrates with SwiftUI (even though there are obvious shortcomings and needs more support/documentation).
I am experiencing a Data Migration crash when updating from the previous version (1.5.0) to the currently ready to deploy version (1.6.0).
Cannot use staged migration with an unknown model version.
In the new version (1.6.0) I am changing the definition of one of my Model objects (SDReceipt). I add a property called documents
which is an optional array of String type.
Please see attached image for a diff on the files in question.
I have tried the following things:
SwiftData Migration Crashing After Adding Transformable.
This Stack Overflow question suggests when adding a transformable (array) make it optional – that didn’t fix it.
https://hachyderm.io/@blake/111397966921545153.
This post talks about a couple things:
- Make sure you do not change any of the previous Schema Definitions (no change there for me)
- He also makes a note about using a .custom migration instead of lightweight (even though it shouldn’t be needed in my case.)
I confirmed all of this in my code and nothing helped.
How can I further debug this issue other than getting a pretty generic “Cannot use staged migration with an unknown model version”?
2