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.Design.Tests/Design/OperationExecutorTest.cs b/test/EFCore.Design.Tests/Design/OperationExecutorTest.cs index 7e185a7610b..e4fad62bc83 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.Ignore(RelationalEventId.MigrationsNotFound)); private class FakeMigrationsIdGenerator : MigrationsIdGenerator { 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);