Skip to content

Commit 48cd087

Browse files
committed
Suppress PendingModelChangesWarning in DbContext after EF Core 9 upgrade
EF Core 9 throws PendingModelChangesWarning during Migrate() when the snapshot fingerprint format changed from EF Core 8. EF tooling confirms no actual model changes are pending. Suppress the warning per the EF Core docs recommendation to prevent startup crashes.
1 parent 526f183 commit 48cd087

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backend/src/Taskdeck.Infrastructure/DependencyInjection.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.EntityFrameworkCore;
2+
using Microsoft.EntityFrameworkCore.Diagnostics;
23
using Microsoft.Extensions.Configuration;
34
using Microsoft.Extensions.DependencyInjection;
45
using Taskdeck.Application.Interfaces;
@@ -16,7 +17,12 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi
1617
?? "Data Source=taskdeck.db";
1718

1819
services.AddDbContext<TaskdeckDbContext>(options =>
19-
options.UseSqlite(connectionString));
20+
options
21+
.UseSqlite(connectionString)
22+
// EF Core 9 introduced PendingModelChangesWarning which throws when upgrading
23+
// from EF Core 8 snapshots. EF tooling confirms no actual model changes are
24+
// pending; suppress to allow startup after the snapshot format migration.
25+
.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning)));
2026

2127
services.AddScoped<IBoardRepository, BoardRepository>();
2228
services.AddScoped<IColumnRepository, ColumnRepository>();

0 commit comments

Comments
 (0)