1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:07:38 +08:00

Fix realm migration failures when upgrading from old versions

* `RealmRulesetSetting` was added in 2021.916.0.
* `RealmKeyBinding` was added in 2021.703.0.

Attempting to upgrade from older releases than the above would cause
migrations up to schema versions 10 and 11 to fail.
This commit is contained in:
Bartłomiej Dach 2021-11-28 15:00:40 +01:00
parent 51a7c60eec
commit 93b5aec23e
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -307,6 +307,9 @@ namespace osu.Game.Database
case 10:
string rulesetSettingClassName = getMappedOrOriginalName(typeof(RealmRulesetSetting));
if (!migration.OldRealm.Schema.TryFindObjectSchema(rulesetSettingClassName, out _))
return;
var oldSettings = migration.OldRealm.DynamicApi.All(rulesetSettingClassName);
var newSettings = migration.NewRealm.All<RealmRulesetSetting>().ToList();
@ -329,6 +332,9 @@ namespace osu.Game.Database
case 11:
string keyBindingClassName = getMappedOrOriginalName(typeof(RealmKeyBinding));
if (!migration.OldRealm.Schema.TryFindObjectSchema(keyBindingClassName, out _))
return;
var oldKeyBindings = migration.OldRealm.DynamicApi.All(keyBindingClassName);
var newKeyBindings = migration.NewRealm.All<RealmKeyBinding>().ToList();