How to update breaking-change schema of a Synced Realm during development?

I’m having problems understanding the concept of schema updates in the context of Atlas Device Synced Realm. The documentation doesn’t make it clear on what is the approach to migrate breaking changes. The only 2 options available are stated as:

  1. Partner collection
  2. Client reset

Partner collection is more for production environment - and even then I’d rather not have every breaking change to have a partner collection… 100 breaking changes = 100x write per collection? Ideally, I’d like to have a schema versioned so that my app can handle the migration on a breaking change… anyway I digress.

So I figured, option 2! Client reset each time there is a breaking change, so that the client will delete the local realm and sync up to the new schema… Nope this does not work at all. I’m currently sitting on this issue where I’ve reset the device sync service many times in App Services UI, but it is still giving me a non-descriptive error message below:

I/flutter ( 6870): [INFO] Realm: Connection[1]: Session[1]: client_reset_config = false, Realm exists = true, client reset = false
I/flutter ( 6870): [INFO] Realm: Connected to endpoint '' (from '')
I/flutter ( 6870): [INFO] Realm: Verifying server SSL certificate using 155 root certificates
I/flutter ( 6870): [INFO] Realm: Connection[1]: Connected to app services with request id: "63ecb35db314827f0e6bfb8b"
I/flutter ( 6870): [INFO] Realm: Connection[1]: Session[1]: Received: ERROR "Invalid query (IDENT, QUERY): failed to parse query: query contains table not in schema: "UserQuery"" (error_code=226, try_again=false, error_action=ApplicationBug)

I tried to delete the realm manually during the error handling but to no avail:

syncErrorHandler: (syncError) {
        log().d('syncErrorHandler : ${syncError.category} $syncError');

Any assistance would be much appreciated thanks.

I’m currently using the Flutter Realm 1.0.0.

Hi @lHengl!
To handle the breaking changes you have to use clientResetHandler instead of syncErrorHandler. We recommend using the “Recover or Discard Unsynced Changes Mode” strategy in such cases, since it will try to automatically recover the changes. If this is not possible then the automatic recovery fails and it tries to discard unsynced changes. In case discarding changes fails the execution will go into the onManualResetFallback, where you can prompt the users before resetting the realm file (clientResetError.resetRealm()). You can find a detailed example about onManualResetFallback implementation in “Manual Client Reset Fallback” documentation.
Feel free to comment if anything is unclear from the documentation.

Thank you, I fixed my issue by uninstalling the app. I will try these strategy next I come across a breaking change and report back.