mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 13:22:55 +08:00
Add basic realm migration support
This commit is contained in:
parent
5d7ab4a7f1
commit
ae76eca564
@ -43,6 +43,15 @@ namespace osu.Game.Database
|
||||
this.storage = storage;
|
||||
this.scheduler = scheduler;
|
||||
recreateThreadContexts();
|
||||
|
||||
using (CreateContext())
|
||||
{
|
||||
// ensure our schema is up-to-date and migrated.
|
||||
}
|
||||
}
|
||||
|
||||
private void onMigration(Migration migration, ulong oldschemaversion)
|
||||
{
|
||||
}
|
||||
|
||||
private static readonly GlobalStatistic<int> reads = GlobalStatistics.Get<int>("Realm", "Get (Read)");
|
||||
@ -158,7 +167,11 @@ namespace osu.Game.Database
|
||||
protected virtual Realm CreateContext()
|
||||
{
|
||||
contexts.Value++;
|
||||
return Realm.GetInstance(new RealmConfiguration(storage.GetFullPath($"{database_name}.realm", true)));
|
||||
return Realm.GetInstance(new RealmConfiguration(storage.GetFullPath($"{database_name}.realm", true))
|
||||
{
|
||||
SchemaVersion = 2,
|
||||
MigrationCallback = onMigration
|
||||
});
|
||||
}
|
||||
|
||||
public void ResetDatabase()
|
||||
|
Loading…
Reference in New Issue
Block a user