concept Migrate in category entity framework

This is an excerpt from Manning's book Entity Framework Core in Action, SE.
If you want to run your seed database method only when a new migration has been applied, you can use the DbContext method
Database.GetPendingMigrationsto get the list of migrations that are about to be applied. If this returns an empty collection, then there is no pending migration on the current database. You must callGetPendingMigrationsbefore you execute theDatabase.Migratemethod, because the pending migrations collection is empty after theMigratemethod has finished.

This is an excerpt from Manning's book Entity Framework Core in Action.
If you’re running this example application downloaded from the Git repo that goes with this book, you don’t need to use the
Migratecommands that follow. The code uses thecontext.Database.EnsureCreatedcommand to create the database. This is less flexible thanMigrate, but it doesn’t require you to type any commands.
This chapter covers the three ways of changing the structure of a database. The structure of the database is called the database schema—the tables, columns, constraints, and so on that make up a database. Creating and updating a database schema can seem simple because EF Core provides a method called
Migrateto do it all for you; you create your entity classes and add a bit of configuration, and EF Core builds you a nice, shiny database.The problem is that EF Core’s
Migratemethod hides a whole series of database migration issues that might not be immediately apparent; for example, moving data from one entity class to another entity class can cause loss of data when applying a database schema change. Getting a database change wrong on a database that has live data in it is a scary problem.