mirror of
https://github.com/ppy/osu
synced 2025-02-19 11:56:58 +00:00
Add migration of existing settings
This commit is contained in:
parent
ac377a2e3c
commit
2bcb3fd304
@ -469,6 +469,25 @@ namespace osu.Game
|
||||
|
||||
db.Context.RemoveRange(existingBindings);
|
||||
|
||||
var existingSettings = db.Context.DatabasedSetting;
|
||||
|
||||
// only migrate data if the realm database is empty.
|
||||
if (!usage.Realm.All<RealmSetting>().Any())
|
||||
{
|
||||
foreach (var dkb in existingSettings)
|
||||
{
|
||||
usage.Realm.Add(new RealmSetting
|
||||
{
|
||||
ValueString = dkb.StringValue,
|
||||
Key = dkb.Key,
|
||||
RulesetID = dkb.RulesetID,
|
||||
Variant = dkb.Variant
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
db.Context.RemoveRange(existingSettings);
|
||||
|
||||
usage.Commit();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user