diff --git a/RetainerTrack/Database/Migrations/20240524201345_ImportLegacyData.cs b/RetainerTrack/Database/Migrations/20240524201345_ImportLegacyData.cs
index 332eaac..a559c61 100644
--- a/RetainerTrack/Database/Migrations/20240524201345_ImportLegacyData.cs
+++ b/RetainerTrack/Database/Migrations/20240524201345_ImportLegacyData.cs
@@ -4,97 +4,23 @@ using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using Dalamud.Plugin;
-using LiteDB;
using Microsoft.EntityFrameworkCore.Migrations;
-using RetainerTrack.LegacyDb;
#nullable disable
-#pragma warning disable 0612
namespace RetainerTrack.Database.Migrations
{
///
public partial class ImportLegacyData : Migration
{
- public static DalamudPluginInterface PluginInterface { get; set; }
-
- private static readonly string[] PlayerColumns = new[] { "LocalContentId", "Name" };
- private static readonly string[] RetainerColumns = new []{ "LocalContentId", "Name", "WorldId", "OwnerLocalContentId" };
-
///
protected override void Up(MigrationBuilder migrationBuilder)
{
- if (PluginInterface == null)
- return;
-
- string legacyDatabaseFileName = Path.Join(PluginInterface.GetPluginConfigDirectory(), "retainer-data.litedb");
- if (!File.Exists(legacyDatabaseFileName))
- return;
-
- using var liteDatabase = new LiteDatabase(new ConnectionString
- {
- Filename = Path.Join(PluginInterface.GetPluginConfigDirectory(), "retainer-data.litedb"),
- Connection = ConnectionType.Direct,
- Upgrade = true,
- },
- new BsonMapper
- {
- ResolveCollectionName = (type) =>
- {
- if (type == typeof(LegacyPlayer))
- return LegacyPlayer.CollectionName;
-
- if (type == typeof(LegacyRetainer))
- return LegacyRetainer.CollectionName;
- throw new ArgumentOutOfRangeException(nameof(type));
- }
- });
- liteDatabase.GetCollection()
- .EnsureIndex(x => x.Id);
- liteDatabase.GetCollection()
- .EnsureIndex(x => x.Id);
-
- List allPlayers = liteDatabase.GetCollection().FindAll().ToList();
- object[,] playersToInsert = To2DArray(
- allPlayers.Select(player => new object[] { player.Id, player.Name }).ToList(),
- PlayerColumns.Length);
-
- migrationBuilder.InsertData(
- table:"Players",
- columns: PlayerColumns,
- values: playersToInsert);
-
- List allRetainers = liteDatabase.GetCollection().FindAll().ToList();
- object[,] retainersToInsert = To2DArray(
- allRetainers.Select(retainer => new object[] { retainer.Id, retainer.Name, retainer.WorldId, retainer.OwnerContentId }).ToList(),
- RetainerColumns.Length);
-
- migrationBuilder.InsertData(
- table: "Retainers",
- columns: RetainerColumns, values: retainersToInsert);
- }
-
- [SuppressMessage("Performance", "CA1814")]
- private static object[,] To2DArray(IReadOnlyList