Update-Database command is not working in ASP.Net Core / Entity Framework Core because object in database already exists

There is no -IgnoreChanges currently in EF Core (see here) but you can achieve the equivalent by commenting out all the code in the Up() method and applying the migration. This will take a snapshot of the current model state so that subsequent migrations will only include changes from that point forward.

So if you just made some incremental model change and you don’t have this initial baseline you may need to remove those changes, apply the baseline migration, then add your changes back and add a 2nd migration.

Leave a Comment