From the course: Learning Entity Framework Core
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Migrations - Entity Framework Tutorial
From the course: Learning Entity Framework Core
Migrations
- [Instructor] Now that you have your Actor model, you can use migrations to create to database, especially since we've also configured our connection string. The purpose of migrations, is to update the database schema instead of dropping and recreating it manually. So in short, it keeps your database in sync with your models. And to do this, we'll go to Tools, NuGet Package Manager and open your Package Manager Console, if it's not already open. Now I already have it open. But that's the way you can navigate to it. And again, there's a quick launch that you could also just type in package, and it should be one of the first options up there. But in the console, let's go ahead and type in Add, I'll hit the tab key IntelliSense gives me Migrations as an option, I'll choose that, and I'll enter in Initial Migration since this is the first time we're doing this. And what this is going to do, is scaffold a migration to create the initial set of tables for your model. Now it's not going to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.