23 lines
797 B
C#
23 lines
797 B
C#
using BlueLaminate.EFCore.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace BlueLaminate.EFCore.Configurations;
|
|
|
|
public class SkinSweepConfiguration : IEntityTypeConfiguration<SkinSweep>
|
|
{
|
|
public void Configure(EntityTypeBuilder<SkinSweep> 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);
|
|
}
|
|
}
|