using Domain.Entities.Donations; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Donations; public class CrewSessionConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable(nameof(CrewSession), x => x.HasComment("크루 후원 방송 세션")); builder.HasKey(x => x.ID); builder.HasOne(x => x.Crew).WithMany(x => x.Sessions).HasForeignKey(x => x.CrewID).OnDelete(DeleteBehavior.Cascade); builder.HasIndex(x => new { x.CrewID, x.Status }); builder.HasIndex(x => new { x.CrewID, x.StartedAt }); builder.Property(x => x.Title).HasMaxLength(200).IsRequired(); } }