Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EF Core generates the same migration even though nothing has changed in the model #23792

Closed
cesarsouza opened this issue Jan 1, 2021 · 1 comment

Comments

@cesarsouza
Copy link

The issue seems to happen when the model combines owned entities with data seeding. I am sending a sample project reproducing the issue attached. I am using EF Core is 5.0.1.

The project contains a barebones ApplicationDbContext and a class implementing IEntityTypeConfiguration for an ApplicationUser class and another, almost empty, entity. For some reason, apparently the presence of a Guid field serving as an alternate key was also necessary to trigger the issue, but I could have been mistaken.

To reproduce the problem, run

add-migration a
add-migration b

and inspect the generated migrations. They are exactly the same, dropping and adding exactly the same tables and the same data (i.e. so in reality, both migrations should have been empty since nothing had changed in the model).

Include provider and version information

EF Core version: 5.0.1
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 5.0
Operating system: Windows 10
IDE: 16.9 preview 1

repro-migrations.zip

@ajcvickers
Copy link
Contributor

@AndriySvyryd This repros for me, even when using the 6.0.0-alpha.1.21055.6 daily build. Could be related to model data diffing.

@AndriySvyryd AndriySvyryd self-assigned this Jan 8, 2021
@AndriySvyryd AndriySvyryd added this to the 5.0.3 milestone Jan 8, 2021
@AndriySvyryd AndriySvyryd removed their assignment Jan 13, 2021
AndriySvyryd added a commit that referenced this issue Jan 13, 2021
AndriySvyryd added a commit that referenced this issue Jan 14, 2021
AndriySvyryd added a commit to dotnet-maestro-bot/EntityFrameworkCore that referenced this issue Jan 14, 2021
This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants