Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework applying too many migrations

We use Entity Framework 6.0 and added a new table using Code First. As usual, we created the EntityMap and added the entity and the map to the context. When we try to upgrade the database using the package manager console command "update-database -script", EF wants to apply all migrations (including the ones that are already in the __MigrationHistory table).

Has anyone experienced the same issue and knows how to solve it?

Thanks in advance

like image 639
xeraphim Avatar asked Feb 06 '26 19:02

xeraphim


1 Answers

We found the issue thanks to the comment of @Amy... When adding the Parameter -Verbose, it became clear that the migrations will be applied to a (new) localDb. We didn't specify the -StartUpProjectName and assumed, it will be the selected default Project. After the -StartUpProjectName was set, everything worked fine :-)

like image 100
xeraphim Avatar answered Feb 08 '26 23:02

xeraphim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!