Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CI EntityFramework Core missing migration check

I have an idea to add "missing migration" check to my CI pipeline. This check should validate that DbSnapshot that is present in a branch matches models in that branch (in another words, it should validate that if I will create a migration, Up and Down would be empty).

Straightforward way of doing this would be to execute dotnet ef migrations add Test and validate that resulting files match "empty migration" ones, but this seems like a hack.

Is there an easier way of doing this? Like dotnet ef migrations --verify-snapshot-up-to-date or something?

like image 958
maxc137 Avatar asked May 19 '26 18:05

maxc137


1 Answers

Starting EF Core 8 there's a dotnet ef migrations has-pending-model-changes command that does that 🎉

like image 147
maxc137 Avatar answered May 21 '26 07:05

maxc137



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!