Simplify migration to not rely on old/dynamic schema

This commit is contained in:
Dean Herbert 2023-02-08 14:24:06 +09:00
parent 5c113ddb03
commit c50ea89bc9

View File

@ -869,17 +869,11 @@ namespace osu.Game.Database
break; break;
case 26: case 26:
// Add ScoreInfo.BeatmapHash property to ensure the score corresponds to the version of beatmap it should // Add ScoreInfo.BeatmapHash property to ensure scores correspond to the correct version of beatmap.
// See: https://github.com/ppy/osu/issues/22062 var scores = migration.NewRealm.All<ScoreInfo>();
string scoreInfoName = getMappedOrOriginalName(typeof(ScoreInfo));
var oldScoreInfos = migration.OldRealm.DynamicApi.All(scoreInfoName); foreach (var score in scores)
var newScoreInfos = migration.NewRealm.All<ScoreInfo>(); score.BeatmapHash = score.BeatmapInfo.Hash;
for (int i = 0; i < newScoreInfos.Count(); i++)
{
newScoreInfos.ElementAt(i).BeatmapHash = oldScoreInfos.ElementAt(i).BeatmapInfo.Hash;
}
break; break;
} }