Use context .Database.Migrate ()
You can call this from your Startup class:
using (var context = new MyContext(...)) { context.Database.Migrate(); }
It will transfer your database to the latest version when the application starts. But be careful, perhaps comment out this code and disagree only when you want to complete your migrations.
source share