Open bgoncal opened 3 months ago
➤ PM Bot commented:
Jira ticket: RCOCOA-2417
Also, after the watch app crashes because "migration is required", the schema version is bumped anyways, so if I try to run a version that uses schema 27 afterwards it also crashes saying "27 is lower than 29".
Ok, I may have found the root cause:
Can someone coment on that?
The migration callback should be invoked when you change the schema version, even if the models are the same.
Well... it didn't happen, it only started working after I removed object types from the initialization.
Or you mean manually called?
How frequently does the bug occur?
Always
Description
I need to run the migration block of my Realm from schema 27 to 29, it works flawless in iOS, but in watchOS as soon as the app try to access Realm,
schemaVersionAtURL()
already returns 29 instead of 27, causing the migration to not run.I already tried to delete the app in both devices, reboot devices install old version of the app (with schema 27) and upgrading it to the app version with schema 29.
What could cause the schema version to be 29 already even though Realm was not initialized before?
Luckily I am working on an open source project so here it is where I initialise Realm (line 37): https://github.com/home-assistant/iOS/blob/master/Sources/Shared/Common/Extensions/Realm%2BInitialization.swift
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
10.35 - 10.52.2
What Atlas Services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
iOS 17.4 and watchOS 10.4
Build environment
Xcode version: 15.4 Dependency manager and version: Cocoapods