Can I generate script of a migration with EF code first and .net core

As per EF documentation you can use Script-Migration command.

If you want to just script all the migrations you can simply call it from Package Manager console like that. If you want to just script the changes from the last migration you can call it like this:

Script-Migration -From <PreviousMigration> -To <LastMigration>

Be sure to check the docs, there’re a few more options to the command.

Leave a Comment