feat(viewer): add MyPageBgSelectType + MyPageBgId scalars + MyPageBgRotation owned collection

Adds BGType persistence (0=Deck/1=CustomBG/2=RandomBG) to Viewer via two scalar
columns and an owned collection keyed (ViewerId, Slot). Two persistence tests
confirm round-trip and zero-defaults on fresh viewers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-09 16:26:48 -04:00
parent 8de78ba7ed
commit ee808a60a2
4 changed files with 91 additions and 0 deletions

View File

@@ -172,6 +172,12 @@ public class SVSimDbContext : DbContext
b.HasKey("ViewerId", nameof(ViewerFreePackClaim.FreeGachaCampaignId));
b.Property(x => x.FreeGachaCampaignId).ValueGeneratedNever();
});
modelBuilder.Entity<Viewer>().OwnsMany(v => v.MyPageBgRotation, b =>
{
b.WithOwner().HasForeignKey("ViewerId");
b.HasKey("ViewerId", nameof(MyPageBgRotationEntry.Slot));
b.Property(x => x.Slot).ValueGeneratedNever();
});
// OwnedCardEntry and OwnedItemEntry use composite PK (ViewerId, Id) where Id is auto-
// generated, which silently permits multiple rows per (Viewer, Card) or (Viewer, Item).