Skip to content

Commit 82932f7

Browse files
Copilotdanielgerlag
andcommitted
Improve warning handling by logging instead of ignoring PendingModelChangesWarning
Co-authored-by: danielgerlag <[email protected]>
1 parent cb41852 commit 82932f7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/providers/WorkflowCore.Persistence.EntityFramework/Services/WorkflowDbContext.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
5757
base.OnConfiguring(optionsBuilder);
5858
optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
5959

60-
// Suppress pending model changes warning when using newer EF Core versions with older ModelSnapshots
61-
// This prevents false positive warnings when the ProductVersion in ModelSnapshot differs from runtime
60+
// Configure warning handling for PendingModelChangesWarning
61+
// This warning can be triggered by:
62+
// 1. ProductVersion mismatch (false positive when using EF Core 9.x with older snapshots)
63+
// 2. Legitimate model changes that need migrations
64+
//
65+
// We convert the warning to a log message so developers can still see it in logs
66+
// but it won't throw an exception that prevents application startup
6267
optionsBuilder.ConfigureWarnings(warnings =>
63-
warnings.Ignore(Microsoft.EntityFrameworkCore.Diagnostics.RelationalEventId.PendingModelChangesWarning));
68+
warnings.Log(Microsoft.EntityFrameworkCore.Diagnostics.RelationalEventId.PendingModelChangesWarning));
6469
}
6570
}
6671
}

0 commit comments

Comments
 (0)