feat(replay): add ViewerBattleHistory entity + migration

New table backs /replay/info; composite PK (ViewerId, BattleId), index on
(ViewerId, CreateTime) for the newest-first list query. 50-row per-viewer
retention enforced by BattleHistoryWriter (next commit).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-10 07:32:05 -04:00
parent 2d65fcd91c
commit 0bb0f46abc
6 changed files with 4916 additions and 0 deletions

View File

@@ -2843,6 +2843,83 @@ namespace SVSim.Database.Migrations
b.ToTable("ViewerArenaTwoPickRuns");
});
modelBuilder.Entity("SVSim.Database.Models.ViewerBattleHistory", b =>
{
b.Property<long>("ViewerId")
.HasColumnType("bigint");
b.Property<long>("BattleId")
.HasColumnType("bigint");
b.Property<DateTime>("BattleStartTime")
.HasColumnType("timestamp with time zone");
b.Property<int>("BattleType")
.HasColumnType("integer");
b.Property<DateTime>("CreateTime")
.HasColumnType("timestamp with time zone");
b.Property<int>("DeckFormat")
.HasColumnType("integer");
b.Property<int>("IsLimitTurn")
.HasColumnType("integer");
b.Property<bool>("IsWin")
.HasColumnType("boolean");
b.Property<int>("OpponentCharaId")
.HasColumnType("integer");
b.Property<int>("OpponentClassId")
.HasColumnType("integer");
b.Property<string>("OpponentCountryCode")
.IsRequired()
.HasColumnType("text");
b.Property<long>("OpponentDegreeId")
.HasColumnType("bigint");
b.Property<long>("OpponentEmblemId")
.HasColumnType("bigint");
b.Property<string>("OpponentName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("OpponentRotationId")
.IsRequired()
.HasColumnType("text");
b.Property<int>("OpponentSubClassId")
.HasColumnType("integer");
b.Property<int>("SelfCharaId")
.HasColumnType("integer");
b.Property<int>("SelfClassId")
.HasColumnType("integer");
b.Property<string>("SelfRotationId")
.IsRequired()
.HasColumnType("text");
b.Property<int>("SelfSubClassId")
.HasColumnType("integer");
b.Property<int>("TwoPickType")
.HasColumnType("integer");
b.HasKey("ViewerId", "BattleId");
b.HasIndex("ViewerId", "CreateTime")
.HasDatabaseName("IX_ViewerBattleHistories_ViewerId_CreateTime");
b.ToTable("ViewerBattleHistories");
});
modelBuilder.Entity("SVSim.Database.Models.ViewerBattlePassClaimEntry", b =>
{
b.Property<long>("Id")