using BlueLaminate.EFCore.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace BlueLaminate.EFCore.Configurations; public class SkinSweepConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder entity) { // One checkpoint per skin per site: the natural key the upsert relies on. entity.HasIndex(e => new { e.SkinId, e.Source }).IsUnique(); // Mirror SkinConditionSweep: index the (source, swept_at) ordering each sweep scans. entity.HasIndex(e => new { e.Source, e.SweptAt }); entity.HasOne(e => e.Skin) .WithMany(s => s.Sweeps) .HasForeignKey(e => e.SkinId) .OnDelete(DeleteBehavior.Cascade); } }