This chapter covers ways of changing the structure of a database, referred to as migrating a database. The structure of the database is called the database schema; it consists of the tables, columns, constraints, and so on that make up a database. Creating and updating a database schema can seem to be 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 of database migration issues that aren’t immediately obvious. Renaming a property in an entity class, for example, by default causes that property’s database column to be deleted, along with any data it had! So in this chapter, in addition to detailing how to build and apply database migrations, I cover the key issues that you must consider when updating a database. No one wants to be the person who breaks your “live” database.