using Domain.Entities.Developers; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Developers; public class ApiPurchaseCancelConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasIndex(x => x.PurchaseID).IsUnique(); builder.HasIndex(x => x.ApplicationID); builder.HasIndex(x => x.ChannelID); builder.HasIndex(x => x.CreatedAt); builder.ToTable(nameof(ApiPurchaseCancel), x => x.HasComment("API 결제 취소 감사 기록 (1 결제 1 취소)")); builder.HasKey(x => x.ID); // 원장(ApiPurchase) 보존 — 취소 기록이 있는 결제는 삭제 불가 builder.HasOne(x => x.Purchase).WithMany().HasForeignKey(x => x.PurchaseID).OnDelete(DeleteBehavior.Restrict); } }