mirror of
https://github.com/osukey/osukey.git
synced 2025-05-02 12:17:27 +09: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);
|
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();
|
usage.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user