feat(bp): repositories + identity generation for runtime-inserted tables
Add ValueGeneratedOnAdd to ViewerBattlePassProgress.Id and ViewerBattlePassClaims.Id so Postgres generates IDENTITY values at runtime. Regenerate AddBattlePass migration in-place to include the IdentityByDefaultColumn annotations. Add IBattlePassRepository / BattlePassRepository (season lookup + level-curve cache) and IViewerBattlePassRepository / ViewerBattlePassRepository (get-or-create progress, claim reads/writes). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -230,12 +230,14 @@ public class SVSimDbContext : DbContext
|
||||
modelBuilder.Entity<ViewerBattlePassProgressEntry>(b =>
|
||||
{
|
||||
b.HasKey(e => e.Id);
|
||||
b.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||
b.HasIndex(e => new { e.ViewerId, e.SeasonId }).IsUnique();
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ViewerBattlePassClaimEntry>(b =>
|
||||
{
|
||||
b.HasKey(e => e.Id);
|
||||
b.Property(e => e.Id).ValueGeneratedOnAdd();
|
||||
b.HasIndex(e => new { e.ViewerId, e.SeasonId, e.Track, e.Level }).IsUnique();
|
||||
b.HasIndex(e => new { e.ViewerId, e.SeasonId });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user