Help Rescuing SwiftData Schema with Non-Optional Transformables

I currently have a schema in production (cloudKit and local files) containing non-optional transformable values, e.g.

@Attribute(.transformable(by: TestTransformer.self))
        var number: TestTransformable = TestTransformable.init(value: 100)

Unfortunately, this is preventing any migration from succeeding (documented at length in FB22151570).

Briefly summarized, any migration from a Schema containing non-optional transformable values fails between willMigrate and didMigrate with the error "Can't find model for source store". This occurs for all migrations, including lightweight with a migration plan, lightweight without a plan, and custom migrations. Worst of all, this also prevents migration to optional transformable values, or the elimination of the transformable value entirely, leaving us completely stuck.

(note: optional transformable values only work when they have a default value set to nil, otherwise even these have issues migrating)

We already have features being blocked by this issue, and would like to preserve user-data while restoring our ability to move forwards with database.

Are there any known workarounds for using SwiftData (+CloudKit) when schema migration is non-operational?

Thank you for the post and the Feedback provided.

The source store issue in this case should be resolved by adding the NSSecureCoding conformance to TestTransformer.

Help Rescuing SwiftData Schema with Non-Optional Transformables
 
 
Q