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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.