1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 17:12:54 +08:00

Don't migrate existing key bindings across if realm is already populated

This commit is contained in:
Dean Herbert 2021-01-11 16:00:11 +09:00
parent 56d34432f9
commit f9717e8b69

View File

@ -24,7 +24,6 @@ using osu.Game.Online.API;
using osu.Framework.Graphics.Performance;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Logging;
using osu.Game.Audio;
using osu.Game.Database;
@ -330,6 +329,9 @@ namespace osu.Game
{
var existingBindings = db.Context.DatabasedKeyBinding;
// only migrate data if the realm database is empty.
if (!realm.Context.All<RealmKeyBinding>().Any())
{
foreach (var dkb in existingBindings)
{
realm.Context.Add(new RealmKeyBinding
@ -341,6 +343,7 @@ namespace osu.Game
Variant = dkb.Variant
});
}
}
db.Context.RemoveRange(existingBindings);
}