Phase 3 shipped the AI rank battle bot pool as a hardcoded 8-entry list inlined in SVSim.EmulatedEntrypoint/Matching/BotRoster.cs — editing meant recompiling. Per PLAN.md 2026-06-02 item (d), move it to a Bootstrap importer so the roster lives in seeds/bot-roster.json and the DB. Shape mirrors PracticeOpponent end-to-end: - BotRosterEntry (SVSim.Database/Models) — PK = AiId via the Id passthrough pattern. DbSet<BotRosterEntry> BotRoster on SVSimDbContext. - AddBotRoster migration (DDL only, per migrations-are-DDL-only rule). - seeds/bot-roster.json — 8 rows preserving the current prod-verified cosmetic ids (sleeve 704141010 / emblem 400001100 / degree 120027 / field 5) and series-1 ai_ids from rm_ai_setting.csv (1111..1181). - BotRosterSeed POCO + BotRosterImporter (idempotent upsert keyed by AiId, leaves seed-missing rows intact). Wired into SVSim.Bootstrap/Program.cs next to PracticeOpponentImporter. - IGlobalsRepository.GetBotRoster() + impl. IBotRoster.Pick → PickAsync because BotRoster now depends on the transient IGlobalsRepository. RankBattleController awaits the new signature. The deterministic hash-on-ctx invariant (same ctx → same bot, so /ai_<fmt>/start retries pick the same opponent) is preserved. DI: AddSingleton<IBotRoster> → AddTransient (matches IGlobalsRepository's lifetime). Test fixture's SeedGlobalsAsync also runs the importer so RankBattleControllerTests + the rewritten BotRosterTests both see seeded rows. Tests: 931 → 936 passing. Existing 3 BotRosterTests reshaped for the DB backing + 1 new "throws on empty roster" guard; 4 new BotRosterImporterTests mirror PracticeOpponentImporterTests (round-trip / idempotent / seed-missing-row-intact / ai_id=0 skip). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
50 lines
2.2 KiB
C#
50 lines
2.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SVSim.Database.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddBotRoster : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "BotRoster",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false),
|
|
AiId = table.Column<int>(type: "integer", nullable: false),
|
|
CountryCode = table.Column<string>(type: "text", nullable: false),
|
|
UserName = table.Column<string>(type: "text", nullable: false),
|
|
SleeveId = table.Column<int>(type: "integer", nullable: false),
|
|
EmblemId = table.Column<int>(type: "integer", nullable: false),
|
|
DegreeId = table.Column<int>(type: "integer", nullable: false),
|
|
FieldId = table.Column<int>(type: "integer", nullable: false),
|
|
IsOfficial = table.Column<int>(type: "integer", nullable: false),
|
|
ClassId = table.Column<int>(type: "integer", nullable: false),
|
|
CharaId = table.Column<int>(type: "integer", nullable: false),
|
|
Rank = table.Column<int>(type: "integer", nullable: false),
|
|
BattlePoint = table.Column<int>(type: "integer", nullable: false),
|
|
IsMasterRank = table.Column<int>(type: "integer", nullable: false),
|
|
MasterPoint = table.Column<int>(type: "integer", nullable: false),
|
|
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
DateUpdated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_BotRoster", x => x.Id);
|
|
});
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "BotRoster");
|
|
}
|
|
}
|
|
}
|