You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When two Entities with the same name but different schemas reference a shared entity and they are applied in separate migrations, the Down method of the second migration deletes the Foreign Key Constraint set by the first.
When two Entities with the same name but different schemas reference a shared entity and they are applied in separate migrations, the
Down
method of the second migration deletes the Foreign Key Constraint set by the first.EF Core version: 9.0.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Sqlite
Target framework: .NET 9.0
Operating system: Windows 11
IDE: Visual Studio 2022 and VSCode
The same happens with npgsql: npgsql/efcore.pg#3057
Full example https://github.com/mitsakosgr/efcorewrongmigration
For example the following Entities and DbContext:
generates the following migration:
Adding a second entity with the same name:
generates the following migration:
You can see at the second
Down
it drops the FK from thefirst
schema!The text was updated successfully, but these errors were encountered: