11 Handling database migrations

This chapter covers

  • Using EF Core’s migration to update a database
  • Building a DbContext from an existing database
  • Changing a database by using SQL command scripts
  • Applying updates to your production database

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 Migrate to 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 Migrate method hides a whole series ...

Get Entity Framework Core in Action now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.