almost ready
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using BlueLaminate.EFCore.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace BlueLaminate.EFCore.Configurations;
|
||||
|
||||
public class SkinConditionSweepConfiguration : IEntityTypeConfiguration<SkinConditionSweep>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SkinConditionSweep> entity)
|
||||
{
|
||||
// One checkpoint per band per site: the natural key, and what the upsert
|
||||
// ("stamp") in SweepCheckpoints relies on.
|
||||
entity.HasIndex(e => new { e.SkinConditionId, e.Source }).IsUnique();
|
||||
|
||||
// Each site's sweep orders its bands never-swept-first then stalest; index the
|
||||
// ordering it scans (filter by source, sort by swept_at).
|
||||
entity.HasIndex(e => new { e.Source, e.SweptAt });
|
||||
|
||||
entity.HasOne(e => e.SkinCondition)
|
||||
.WithMany(c => c.Sweeps)
|
||||
.HasForeignKey(e => e.SkinConditionId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user