using Marathon.Infrastructure.Persistence.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Marathon.Infrastructure.Persistence.Configurations; internal sealed class SportConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("Sports"); builder.HasKey(s => s.Code); // Code is the bookmaker's canonical sport id (6 = Basketball, 11 = Football, // 22723 = Tennis, …), a natural key — never an auto-incremented surrogate. // Without this, EF's int-PK convention treats it as ValueGeneratedOnAdd and // tries to alter the column to AUTOINCREMENT on the next migration. builder.Property(s => s.Code).HasColumnType("INTEGER").ValueGeneratedNever().IsRequired(); builder.Property(s => s.NameRu).HasColumnType("TEXT").IsRequired(); builder.Property(s => s.NameEn).HasColumnType("TEXT").IsRequired(); } }