1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Add migration for total score conversion

This commit is contained in:
Dan Balasescu 2023-06-26 17:52:47 +09:00
parent e1d723a2cc
commit 8e79510793
3 changed files with 17 additions and 2 deletions

View File

@ -78,8 +78,9 @@ namespace osu.Game.Database
/// 28 2023-06-08 Added IsLegacyScore to ScoreInfo, parsed from replay files.
/// 29 2023-06-12 Run migration of old lazer scores to be best-effort in the new scoring number space. No actual realm changes.
/// 30 2023-06-16 Run migration of old lazer scores again. This time with more correct rounding considerations.
/// 31 2023-06-26 Add Version to ScoreInfo, set to 30000002.
/// </summary>
private const int schema_version = 30;
private const int schema_version = 31;
/// <summary>
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
@ -966,6 +967,16 @@ namespace osu.Game.Database
break;
}
case 31:
{
var scores = migration.NewRealm.All<ScoreInfo>();
foreach (var score in scores)
score.Version = 30000002; // Last version before legacy total score conversion.
break;
}
}
Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms");

View File

@ -29,9 +29,10 @@ namespace osu.Game.Scoring.Legacy
/// <list type="bullet">
/// <item><description>30000001: Appends <see cref="LegacyReplaySoloScoreInfo"/> to the end of scores.</description></item>
/// <item><description>30000002: Score stored to replay calculated using the Score V2 algorithm.</description></item>
/// <item><description>30000003: First version after legacy total score migration.</description></item>
/// </list>
/// </remarks>
public const int LATEST_VERSION = 30000002;
public const int LATEST_VERSION = 30000003;
/// <summary>
/// The first stable-compatible YYYYMMDD format version given to lazer usage of replays.

View File

@ -15,6 +15,7 @@ using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring.Legacy;
using osu.Game.Users;
using osu.Game.Utils;
using Realms;
@ -63,6 +64,8 @@ namespace osu.Game.Scoring
public double? PP { get; set; }
public int Version { get; set; } = LegacyScoreEncoder.LATEST_VERSION;
[Indexed]
public long OnlineID { get; set; } = -1;