This commit is contained in:
Chomp
2025-10-02 11:39:01 +01:00
parent d99de6d880
commit 136c79b385
@@ -0,0 +1,46 @@
using System.Text.Json.Nodes;
using SPTarkov.DI.Annotations;
namespace SPTarkov.Server.Core.Migration.Migrations;
/// <summary>
/// Password property was removed from profile.info in 4.0
/// </summary>
[Injectable]
public class RemovePassword : AbstractProfileMigration
{
public override string FromVersion
{
get { return "~3.11"; }
}
public override string ToVersion
{
get { return "4.0"; }
}
public override string MigrationName
{
get { return "RemovePassword-SPTSharp"; }
}
public override IEnumerable<Type> PrerequisiteMigrations
{
get { return []; }
}
public override bool CanMigrate(JsonObject profile, IEnumerable<IProfileMigration> previouslyRanMigrations)
{
var hasPassword = profile["info"]?["password"] != null;
return hasPassword;
}
public override JsonObject? Migrate(JsonObject profile)
{
var profileInfo = profile["info"] as JsonObject;
profileInfo?.Remove("password");
return base.Migrate(profile);
}
}