-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database has an unsupported version (24) and cannot be upgraded. #8586
Comments
➤ PM Bot commented: Jira ticket: RCOCOA-2358 |
In addition, it is best not to delete the original existing database and rebuild |
I've looked through the documentation, and it seems that it's not possible to downgrade from 10.49.2 to 10.48.0 because Realm files written by 10.49.2 cannot be read by older versions of Realm. If we stick with 10.49.2, then those users who were previously on version 4.4.1 will continue to experience crashes. What should we do? |
To be clear, those errors are thrown as exceptions and don't cause crashes, which would be unrecoverable error that terminates the program indiscriminately. One approach to handling that without deleting the database is hosting a server that uses a newer Realm Core version. When a user that was on 4.x tries to upgrade to the latest version of the app, you can handle the error message and display a prompt to the user telling them the app needs to do one-time upgrade of their database that requires an internet connection. Then you upload the database, open it on the server which upgrades the file format, then send it back to the device to open it with 10.49+. It's not ideal and may not work for all users if they have massive databases, but it's one way to mitigate the problem. |
Can you tell me what is the Realm Swift version number corresponding to version 9? I checked the release notes but couldn't find the Realm Swift version number corresponding to version 9. |
You can catch the error in a way similar to: do {
try Realm(configuration: config)
} catch let e as Realm.Error where e.code == .unsupportedFileFormatVersion {
// Inform user and delete database
} |
Hello @nirinchev In your previous response, you suggested deleting the database when a version conflict occurs. The reason I ask this question is that the data stored using Realm is not important to the user. |
You need to delete the entire file - deleting the data inside the migration block will not work as we can't open a file that is so old. |
How frequently does the bug occur?
Always
Description
Hello, after upgrading my Realm database from version 4.4.1 to 10.49.2, I encountered crashes. The crash message indicates that the database has an unsupported version (9) and cannot be upgraded.
I followed the advice from this issue downgraded the Realm database to version 10.48.0. After downgrading, users who upgraded from version 4.4.1 to 10.48.0 were able to create Realm databases normally. However, those users who had already upgraded to version 10.49.2 and then downgraded to version 10.48.0 encountered crashes again, with the message "Database has an unsupported version (24) and cannot be upgraded."
Could you please advise on how to ensure that users on version 10.49.2 do not encounter crashes after downgrading?
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
10.49.2
What Atlas Services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
iOS 17.4.1
Build environment
Xcode version: ...
Dependency manager and version: ...
The text was updated successfully, but these errors were encountered: