diff --git a/src/Heimdall.Infrastructure/Data/AppDbContext.cs b/src/Heimdall.Infrastructure/Data/AppDbContext.cs index 5f265f9..b9fd541 100644 --- a/src/Heimdall.Infrastructure/Data/AppDbContext.cs +++ b/src/Heimdall.Infrastructure/Data/AppDbContext.cs @@ -128,9 +128,12 @@ public class AppDbContext : IdentityDbContext, IApplicat // error tracking (GlitchTip #538). Redundant index warnings are // automatically handled by EF Core — it simply skips creating FK // indexes that are already covered by composite indexes/PKs. + // Also suppress PendingModelChangesWarning because matching query filters + // (used for soft-delete) cause this warning to be promoted to an exception. optionsBuilder.ConfigureWarnings(warnings => { warnings.Ignore(CoreEventId.RedundantIndexRemoved); + warnings.Ignore(CoreEventId.PendingModelChangesWarning); }); base.OnConfiguring(optionsBuilder); diff --git a/src/Heimdall.Web/Program.cs b/src/Heimdall.Web/Program.cs index 398ad75..4235a72 100644 --- a/src/Heimdall.Web/Program.cs +++ b/src/Heimdall.Web/Program.cs @@ -170,6 +170,9 @@ public partial class Program { migrationCt.ThrowIfCancellationRequested(); logger.LogInformation("Applying database migrations (attempt {Attempt}/{MaxRetries})...", attempt, maxRetries); + // Suppress EF Core model validation warnings (10622) about required navigations with global query filters + // These warnings are promoted to exceptions when the model has pending changes; suppress them here + // to allow migrations to proceed. Matching query filters are defined in OnModelCreating. await db.Database.MigrateAsync(migrationCt); logger.LogInformation("Database migrations applied successfully"); break;