Additional card content
This commit is contained in:
@@ -25,6 +25,7 @@ public class SVSimDbContext : DbContext
|
||||
public DbSet<ShadowverseCardEntry> Cards => Set<ShadowverseCardEntry>();
|
||||
public DbSet<ShadowverseCardSetEntry> CardSets => Set<ShadowverseCardSetEntry>();
|
||||
public DbSet<ShadowverseDeckEntry> Decks => Set<ShadowverseDeckEntry>();
|
||||
public DbSet<CardCosmeticReward> CardCosmeticRewards => Set<CardCosmeticReward>();
|
||||
|
||||
public DbSet<ClassEntry> Classes => Set<ClassEntry>();
|
||||
public DbSet<ClassExpEntry> ClassExpCurve => Set<ClassExpEntry>();
|
||||
@@ -115,6 +116,18 @@ public class SVSimDbContext : DbContext
|
||||
modelBuilder.Entity<PackConfigEntry>().OwnsMany(p => p.Banners);
|
||||
modelBuilder.Entity<Viewer>().OwnsMany(v => v.PackOpenCounts);
|
||||
|
||||
modelBuilder.Entity<CardCosmeticReward>(b =>
|
||||
{
|
||||
b.HasKey(r => new { r.CardId, r.Type, r.CosmeticId });
|
||||
b.HasIndex(r => r.CardId);
|
||||
// No inverse nav on the Card side — avoid forcing CosmeticRewards to load on every
|
||||
// Card query. See project_ef_split_query memory for the cartesian-explode risk.
|
||||
b.HasOne(r => r.Card)
|
||||
.WithMany()
|
||||
.HasForeignKey(r => r.CardId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
// GameConfiguration.Config: on Postgres use EF Core 8's OwnsOne+ToJson(jsonb column).
|
||||
// On SQLite (tests) ToJson's WriteJson has a known NullReferenceException when owned
|
||||
// collections are present — use a plain TEXT value converter instead so the same
|
||||
|
||||
Reference in New Issue
Block a user