From 84ee2b8879d632846651b398800de7bdeaf54307 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 03:05:52 +0000 Subject: [PATCH 1/4] Initial plan From 5478312bf80ffef2f175eb24b878df670d056b27 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 03:15:14 +0000 Subject: [PATCH 2/4] Throw on RelationalEventId.MigrationsNotFound by default Changed MigrationsNotFound event log level from Information to Error and added it to the default warning configuration as WarningBehavior.Throw. Updated tests to remove explicit throw configuration since it's now default. Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com> --- .../Infrastructure/RelationalOptionsExtension.cs | 3 ++- .../Properties/RelationalStrings.Designer.cs | 2 +- src/EFCore.Relational/Properties/RelationalStrings.resx | 2 +- .../Migrations/MigrationsInfrastructureSqlServerTest.cs | 6 ++---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/EFCore.Relational/Infrastructure/RelationalOptionsExtension.cs b/src/EFCore.Relational/Infrastructure/RelationalOptionsExtension.cs index a052b74c1eb..aae9b10e890 100644 --- a/src/EFCore.Relational/Infrastructure/RelationalOptionsExtension.cs +++ b/src/EFCore.Relational/Infrastructure/RelationalOptionsExtension.cs @@ -463,7 +463,8 @@ public static CoreOptionsExtension WithDefaultWarningConfiguration(CoreOptionsEx .TryWithExplicit(RelationalEventId.IndexPropertiesMappedToNonOverlappingTables, WarningBehavior.Throw) .TryWithExplicit(RelationalEventId.ForeignKeyPropertiesMappedToUnrelatedTables, WarningBehavior.Throw) .TryWithExplicit(RelationalEventId.StoredProcedureConcurrencyTokenNotMapped, WarningBehavior.Throw) - .TryWithExplicit(RelationalEventId.PendingModelChangesWarning, WarningBehavior.Throw)); + .TryWithExplicit(RelationalEventId.PendingModelChangesWarning, WarningBehavior.Throw) + .TryWithExplicit(RelationalEventId.MigrationsNotFound, WarningBehavior.Throw)); /// /// Information/metadata for a . diff --git a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs index d1324086fae..64f9c161bfc 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs +++ b/src/EFCore.Relational/Properties/RelationalStrings.Designer.cs @@ -3794,7 +3794,7 @@ public static EventDefinition LogNoMigrationsFound(IDiagnosticsLogger lo static logger => new EventDefinition( logger.Options, RelationalEventId.MigrationsNotFound, - LogLevel.Information, + LogLevel.Error, "RelationalEventId.MigrationsNotFound", level => LoggerMessage.Define( level, diff --git a/src/EFCore.Relational/Properties/RelationalStrings.resx b/src/EFCore.Relational/Properties/RelationalStrings.resx index 37b6701ce00..c703161ce00 100644 --- a/src/EFCore.Relational/Properties/RelationalStrings.resx +++ b/src/EFCore.Relational/Properties/RelationalStrings.resx @@ -867,7 +867,7 @@ No migrations were found in assembly '{migrationsAssembly}'. A migration needs to be added before the database can be updated. - Information RelationalEventId.MigrationsNotFound string + Error RelationalEventId.MigrationsNotFound string Model snapshot was not found in assembly '{migrationsAssembly}'. Skipping pending model changes check. diff --git a/test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsInfrastructureSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsInfrastructureSqlServerTest.cs index d0f28e435dd..eb15e30459b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsInfrastructureSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsInfrastructureSqlServerTest.cs @@ -690,8 +690,7 @@ public void Throws_when_no_migrations() { using var context = new DbContext( Fixture.TestStore.AddProviderOptions( - new DbContextOptionsBuilder().EnableServiceProviderCaching(false) - .ConfigureWarnings(e => e.Throw(RelationalEventId.MigrationsNotFound))).Options); + new DbContextOptionsBuilder().EnableServiceProviderCaching(false)).Options); context.Database.EnsureDeleted(); GiveMeSomeTime(context); @@ -710,8 +709,7 @@ public async Task Throws_when_no_migrations_async() { using var context = new DbContext( Fixture.TestStore.AddProviderOptions( - new DbContextOptionsBuilder().EnableServiceProviderCaching(false) - .ConfigureWarnings(e => e.Throw(RelationalEventId.MigrationsNotFound))).Options); + new DbContextOptionsBuilder().EnableServiceProviderCaching(false)).Options); await context.Database.EnsureDeletedAsync(); await GiveMeSomeTimeAsync(context); From dbf49bfd5bef2fe530fd0f341d5262fb9ba82824 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 04:59:53 +0000 Subject: [PATCH 3/4] Fix AddAndApplyMigration_succeeds_when_no_model_changes by ignoring MigrationsNotFound warning in GnomeContext Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com> --- test/EFCore.Design.Tests/Design/OperationExecutorTest.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/EFCore.Design.Tests/Design/OperationExecutorTest.cs b/test/EFCore.Design.Tests/Design/OperationExecutorTest.cs index 7e185a7610b..9b2c7bb0581 100644 --- a/test/EFCore.Design.Tests/Design/OperationExecutorTest.cs +++ b/test/EFCore.Design.Tests/Design/OperationExecutorTest.cs @@ -1306,7 +1306,8 @@ private static SqliteConnection CreateOpenConnection() protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder .UseSqlite(_connection) - .ReplaceService(); + .ReplaceService() + .ConfigureWarnings(w => w.Log(RelationalEventId.MigrationsNotFound)); private class FakeMigrationsIdGenerator : MigrationsIdGenerator { From fecd90ce96f267216f67042fe6de516c3832e321 Mon Sep 17 00:00:00 2001 From: Andriy Svyryd Date: Wed, 4 Mar 2026 12:52:49 -0800 Subject: [PATCH 4/4] Update test/EFCore.Design.Tests/Design/OperationExecutorTest.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- test/EFCore.Design.Tests/Design/OperationExecutorTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/EFCore.Design.Tests/Design/OperationExecutorTest.cs b/test/EFCore.Design.Tests/Design/OperationExecutorTest.cs index 9b2c7bb0581..e4fad62bc83 100644 --- a/test/EFCore.Design.Tests/Design/OperationExecutorTest.cs +++ b/test/EFCore.Design.Tests/Design/OperationExecutorTest.cs @@ -1307,7 +1307,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder .UseSqlite(_connection) .ReplaceService() - .ConfigureWarnings(w => w.Log(RelationalEventId.MigrationsNotFound)); + .ConfigureWarnings(w => w.Ignore(RelationalEventId.MigrationsNotFound)); private class FakeMigrationsIdGenerator : MigrationsIdGenerator {