How to run two versions of RealmSwift? Database has an unsupported version (9) and cannot be upgraded

I have this error for some users: Database has an unsupported version (9) and cannot be upgraded

So I understand I must run v10.48.0 to upgrade from v9 DBs, but I’m already running a later version in production.

Is it possible to fork RealmSwift and run v10.48.0 alongside a later version, exclusively for upgrading v9 DBs? Any pointers?

I solved this by forking realm swift and realm core to give them a new namespace: GitHub - lake-of-fire/realm-swift-legacy at legacy and then using this to migrate the DB before migrating again (as needed) with the latest version of the non-forked realm. nice 10 hour diversion, and an additional 45 seconds to my build…

edit: couldn’t get it working after all, it crashes on upgrading List

The issue is a little unclear.

If you’re running v9 of the database, how can a later version be run in production? e.g. any later, incompatible version would throw that error every time you try to use Realm.

If the file format is v9, that would mean the SDK is 4.4.1 or earlier, if I remember correctly, from April 2020.

If you run SDK 10.x, it will upgrade prior file formats to v11 to v11, and then any later version can upgrade that. I am not sure v10.48.0 can reach back the v9 without an intermediary version bump.

However, the question is how you’re running a later version and not getting that error.

I was going to run both versions concurrently, to step by step upgrade legacy DBs to the modern format. It would only be used per user once to upgrade. It’s too late for me to downgrade to v10.48.0 without running it alongside the current version to upgrade old user DBs.