Skip to content

Migrations Tool

Erik Ejlskov Jensen edited this page May 27, 2018 · 10 revisions

This tool is currently in Preview state, so bumps may occur!

The tool helps you manage EF Core Migrations in your project using a graphcial user interface (GUI), and without requiring you to install any tools packages in your project.

For general information about EF Core Migrations, see the documentation

To start using the Migrations Tool, create your POCO classes and DbContext, and install the required EF Core provider, as described for example here until the step: Create your database.

There is no need to install the Microsoft.EntityFrameworkCore.Tools package as described, you can use the graphical Migrations Tool instead!

Create your database

Now that you have a model, you can use the Migrations Tool to create a database for you.

  • Right click your project -> EF Core Power Tools -> Migrations Tool

Now that you have a model, you can use migrations to create a database for you. Tools –> NuGet Package Manager –> Package Manager Console Run Add-Migration MyFirstMigration to scaffold a migration to create the initial set of tables for your model. Run Update-Database to apply the new migration to the database. Because your database doesn't exist yet, it will be created for you before the migration is applied. Tip If you make future changes to your model, you can use the Add-Migration command to scaffold a new migration to make the corresponding schema changes to the database. Once you have checked the scaffolded code (and made any required changes), you can use the Update-Database command to apply the changes to the database. EF uses a __EFMigrationsHistory table in the database to keep track of which migrations have already been applied to the database.

Clone this wiki locally