mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Add migration of existing collections database
This commit is contained in:
@ -14,6 +14,7 @@ using System.Threading.Tasks;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
@ -64,8 +65,9 @@ namespace osu.Game.Database
|
||||
/// 18 2022-07-19 Added OnlineMD5Hash and LastOnlineUpdate to BeatmapInfo.
|
||||
/// 19 2022-07-19 Added DateSubmitted and DateRanked to BeatmapSetInfo.
|
||||
/// 20 2022-07-21 Added LastAppliedDifficultyVersion to RulesetInfo, changed default value of BeatmapInfo.StarRating to -1.
|
||||
/// 21 2022-07-27 Migrate collections to realm (BeatmapCollection).
|
||||
/// </summary>
|
||||
private const int schema_version = 20;
|
||||
private const int schema_version = 21;
|
||||
|
||||
/// <summary>
|
||||
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
||||
@ -790,6 +792,27 @@ namespace osu.Game.Database
|
||||
beatmap.StarRating = -1;
|
||||
|
||||
break;
|
||||
|
||||
case 21:
|
||||
try
|
||||
{
|
||||
// Migrate collections from external file to inside realm.
|
||||
// We use the "legacy" importer because that is how things were actually being saved out until now.
|
||||
var legacyCollectionImporter = new LegacyCollectionImporter(this);
|
||||
|
||||
if (legacyCollectionImporter.GetAvailableCount(storage).GetResultSafely() > 0)
|
||||
{
|
||||
legacyCollectionImporter.ImportFromStorage(storage);
|
||||
storage.Delete("collection.db");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// can be removed 20221027 (just for initial safety).
|
||||
Logger.Error(e, "Collections could not be migrated to realm. Please provide your \"collection.db\" to the dev team.");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user