Skip to content

Commit bf3cc19

Browse files
authored
Add note about EF Core 9 PendingModelChangesWarning behavior (#5402)
1 parent f62650a commit bf3cc19

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • entity-framework/core/managing-schemas/migrations

entity-framework/core/managing-schemas/migrations/managing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ dotnet ef migrations has-pending-model-changes
221221

222222
You can also perform this check programmatically using `context.Database.HasPendingModelChanges()`. This can be used to write a unit test that fails when you forget to add a migration.
223223

224+
> [!NOTE]
225+
> Starting with EF Core 9, calling <xref:Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate*> or <xref:Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.MigrateAsync*> with pending model changes throws an exception (event ID <xref:Microsoft.EntityFrameworkCore.Diagnostics.RelationalEventId.PendingModelChangesWarning>). See the [applying migrations documentation](xref:core/managing-schemas/migrations/applying#apply-migrations-at-runtime) and the [breaking change note](xref:core/what-is-new/ef-core-9.0/breaking-changes#pending-model-changes) for more information.
226+
224227
## Resetting all migrations
225228

226229
In some extreme cases, it may be necessary to remove all migrations and start over. This can be easily done by deleting your **Migrations** folder and dropping your database; at that point you can create a new initial migration, which will contain your entire current schema.

0 commit comments

Comments
 (0)