After making a non-breaking change to my schema, I am getting this error:
ending session with error: non-breaking schema change: adding “Bool” column at field “`\xa4\xac\xfd\x9d\xe5\x00\x00;\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00” in schema “CarePlan”, schema changes from clients are restricted when developer mode is disabled (ProtocolErrorCode=225)
Here is my schema before:
class CarePlan: Object, ObjectKeyIdentifiable {
@Persisted(primaryKey: true) var _id: ObjectId
@Persisted var assessmentId: ObjectId?
@Persisted var createdAt: Date = Date()
@Persisted var createdById: ObjectId?
@Persisted var recipientId: ObjectId?
@Persisted var requireResponsesToAllCarePlanTasks: Bool?
@Persisted var sections: List<CarePlan_sections>
@Persisted var serviceId: ObjectId?
@Persisted var signedAt: Date?
@Persisted var tasks: List<CarePlan_tasks>
@Persisted var updatedAt: Date = Date()
@Persisted var workspaceId: ObjectId
}
And here is the updated schema:
class CarePlan: Object, ObjectKeyIdentifiable {
@Persisted(primaryKey: true) var _id: ObjectId
@Persisted var assessmentId: ObjectId?
@Persisted var createdAt: Date = Date()
@Persisted var createdById: ObjectId?
@Persisted var recipientId: ObjectId?
@Persisted var requireResponsesToAllCarePlanTasks: Bool?
@Persisted var requireCareSummary: Bool?
@Persisted var sections: List<CarePlan_sections>
@Persisted var serviceId: ObjectId?
@Persisted var signedAt: Date?
@Persisted var tasks: List<CarePlan_tasks>
@Persisted var updatedAt: Date = Date()
@Persisted var workspaceId: ObjectId
}
The only difference is the optional Bool requireCareSummary
.
Notes about my device sync implementation:
- Development mode is disabled
- I maintain two apps: one for iOS and one for Android
- I have only seen this error for the iOS app in the Device Sync logs located on the Atlas dashboard
- For the Swift iOS app, I am using a Realm instance configured with a
flexibleSyncConfiguration
.
Questions:
- Why is this error occurring?
- How do I prevent it when I make another non-breaking schema change?
- If I can’t prevent it, what logic should I include in my Realm Sync Manager Error Handler to resolve it gracefully?
- Can I configure my app to clear the local realm on an app store update?