From d3ab45084d52566d5a06e1d57c4864e028105ed1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Oct 2021 14:19:58 +0900 Subject: [PATCH] Fix realm migration potentially failing from older releases --- osu.Game/Database/RealmContextFactory.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Database/RealmContextFactory.cs b/osu.Game/Database/RealmContextFactory.cs index 078709ad2d..b5c44927ca 100644 --- a/osu.Game/Database/RealmContextFactory.cs +++ b/osu.Game/Database/RealmContextFactory.cs @@ -137,6 +137,11 @@ namespace osu.Game.Database { var className = typeof(T).Name.Replace(@"Realm", string.Empty); + // version was not bumped when the beatmap/ruleset models were added + // therefore we must manually check for their presence to avoid throwing on the `DynamicApi` calls. + if (!migration.OldRealm.Schema.TryFindObjectSchema(className, out _)) + return; + var oldItems = migration.OldRealm.DynamicApi.All(className); var newItems = migration.NewRealm.DynamicApi.All(className);