| 12345678910111213141516171819202122 |
- using Domain.Entities.Donations;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- namespace Infrastructure.Persistence.Configurations.Donations;
- public class DonationAlertAttemptConfiguration : IEntityTypeConfiguration<DonationAlertAttempt>
- {
- public void Configure(EntityTypeBuilder<DonationAlertAttempt> builder)
- {
- builder.ToTable(nameof(DonationAlertAttempt), x => x.HasComment("후원 알림 재시도 기록"));
- builder.HasKey(x => x.ID);
- builder.HasOne(x => x.Donation).WithMany().HasForeignKey(x => x.DonationID).OnDelete(DeleteBehavior.NoAction);
- builder.HasOne(x => x.DonationAlert).WithMany(x => x.Attempts).HasForeignKey(x => x.DonationAlertID).OnDelete(DeleteBehavior.Cascade);
- builder.HasIndex(x => new { x.DonationID, x.DonationAlertID });
- builder.Property(x => x.IpAddress).HasMaxLength(64);
- builder.Property(x => x.UserAgent).HasMaxLength(1024);
- }
- }
|