From 874bd799e75f5a5e1f290652adc527b283fb7a54 Mon Sep 17 00:00:00 2001 From: MSuMshk <173331402+msumshk@users.noreply.github.com> Date: Mon, 2 Feb 2026 20:31:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=20TenantReviewClaim?= =?UTF-8?q?=20=E5=92=8C=20TenantAuditLog=20=E5=AE=9E=E4=BD=93=E7=9A=84=20E?= =?UTF-8?q?F=20Core=20=E8=A1=A8=E6=98=A0=E5=B0=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 EF Core 使用默认 PascalCase 表名导致的 "relation TenantReviewClaims does not exist" 错误, 将实体映射到正确的 snake_case 表名。 Co-Authored-By: Claude Opus 4.5 --- .../App/Persistence/TakeoutAppDbContext.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/TakeoutAppDbContext.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/TakeoutAppDbContext.cs index 96e904c..122de84 100644 --- a/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/TakeoutAppDbContext.cs +++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/App/Persistence/TakeoutAppDbContext.cs @@ -385,6 +385,8 @@ public class TakeoutAppDbContext( ConfigureTenantBillingStatement(modelBuilder.Entity()); ConfigureTenantSubscriptionHistory(modelBuilder.Entity()); ConfigureTenantPayment(modelBuilder.Entity()); + ConfigureTenantReviewClaim(modelBuilder.Entity()); + ConfigureTenantAuditLog(modelBuilder.Entity()); ConfigureMerchant(modelBuilder.Entity()); ConfigureStore(modelBuilder.Entity()); ConfigureMerchantDocument(modelBuilder.Entity()); @@ -595,6 +597,35 @@ public class TakeoutAppDbContext( builder.HasIndex(x => x.TenantId); } + private static void ConfigureTenantReviewClaim(EntityTypeBuilder builder) + { + builder.ToTable("tenant_review_claims"); + builder.HasKey(x => x.Id); + builder.Property(x => x.TenantId).IsRequired(); + builder.Property(x => x.ClaimedBy).IsRequired(); + builder.Property(x => x.ClaimedByName).HasMaxLength(128).IsRequired(); + builder.Property(x => x.ClaimedAt).IsRequired(); + builder.Property(x => x.ReleasedAt); + builder.HasIndex(x => x.TenantId); + builder.HasIndex(x => x.ClaimedBy); + } + + private static void ConfigureTenantAuditLog(EntityTypeBuilder builder) + { + builder.ToTable("tenant_audit_logs"); + builder.HasKey(x => x.Id); + builder.Property(x => x.TenantId).IsRequired(); + builder.Property(x => x.Action).HasConversion(); + builder.Property(x => x.Title).HasMaxLength(128).IsRequired(); + builder.Property(x => x.Description).HasMaxLength(512); + builder.Property(x => x.OperatorId); + builder.Property(x => x.OperatorName).HasMaxLength(128); + builder.Property(x => x.PreviousStatus).HasConversion(); + builder.Property(x => x.CurrentStatus).HasConversion(); + builder.HasIndex(x => x.TenantId); + builder.HasIndex(x => new { x.TenantId, x.CreatedAt }); + } + private static void ConfigureMerchant(EntityTypeBuilder builder) { builder.ToTable("merchants");