Skip to content

Commit

Permalink
Add migration
Browse files Browse the repository at this point in the history
  • Loading branch information
pacampbell committed Oct 9, 2024
1 parent 8ed1473 commit beafd56
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Arrowgene.Ddon.Database/DdonDatabaseBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static class DdonDatabaseBuilder
private static readonly ILogger Logger = LogProvider.Logger<Logger>(typeof(DdonDatabaseBuilder));
private const string DefaultSchemaFile = "Script/schema_sqlite.sql";

public const uint Version = 21;
public const uint Version = 22;

public static IDatabase Build(DatabaseSetting settings)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Data.Common;

namespace Arrowgene.Ddon.Database.Sql.Core.Migration
{
public class EquipPresetMigration : IMigrationStrategy
{
public uint From => 21;
public uint To => 22;

private readonly DatabaseSetting DatabaseSetting;

public EquipPresetMigration(DatabaseSetting databaseSetting)
{
DatabaseSetting = databaseSetting;
}

public bool Migrate(IDatabase db, DbConnection conn)
{
string adaptedSchema = DdonDatabaseBuilder.GetAdaptedSchema(DatabaseSetting, "Script/migration_equipment_preset.sql");
db.Execute(conn, adaptedSchema);
return true;
}
}
}

2 changes: 1 addition & 1 deletion Arrowgene.Ddon.Shared/Model/Storages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public List<CDataEquipItemInfo> AsCDataEquipItemInfo(EquipType equipType)
public List<CDataCharacterEquipInfo> AsCDataCharacterEquipInfo(EquipType equipType)
{
return GetItems(equipType)
.Select((x, index) => new {item = x, slot = (byte)(index+1)})
.Select((x, index) => new {item = x, slot = (byte)(index + 1)})
.Where(tuple => tuple.item != null)
.Select(tuple => new CDataCharacterEquipInfo()
{
Expand Down

0 comments on commit beafd56

Please sign in to comment.