I came across this while googling and thought I'd also put my solution here for any others it helps:
I was bumping the schema just to use the migrations for ensuring data integrity, and I hadn't actually changed the model. Once I made a change to the model (renamed an attribute I had been meaning to get around to) everything worked fine.
Post
Replies
Boosts
Views
Activity
It seems this is related to using CloudKit. See more here: https://forums.developer.apple.com/forums/thread/744491
I'm experiencing what @mrtnmgi describes too—willMigrate and didMigrate are never called. I have it reproducing in a repeatable test which I've attached to FB13711459.
The documentation should be updated, it seems optional parameters are inferred based on Swift optionality via ?.
Replace this:
@OptionalParameter(title: "Quantity") var quantity: Int?
with this:
@Parameter(title: "Quantity") var quantity: Int?
The user won't be required to specify the parameter.