© Eric Vogel 2021
E. VogelBeginning Entity Framework Core 5https://doi.org/10.1007/978-1-4842-6882-7_14

14. Migrations

Eric Vogel1  
Okemos, MI, USA

In this chapter, I will cover how migrations work in Entity Framework Core 5. A migration allows you to version database changes in your application. I will cover how you can add and run migrations. I will also cover how you can update to a given database version or revert to a previous migration.

What Is a Migration?

In prior chapters, I have covered how to add a new migration and how to update your database to the latest migration. A migration is code that alters your database and contains two methods: Up() and Down(). The Up() method will make the necessary changes to your database to update it. ...

Get Beginning Entity Framework Core 5: From Novice to Professional now with O’Reilly online learning.

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