Revert to a previous migration

In order to revert to a previous migration run this comman on the “Package Manager Console”

Update-Database -TargetMigration:"MigrationName"

If you need to revert to the first one run this command

Update-Database -TargetMigration:0

Entity Framework enable migration based on DbContext situated in another project

In order to create a new locally database to run tests you can create your migrations in the test project by taking in care that you can use your repository db context in another VS project.

To achieve this result you can do the following in the Package Manager Console

Enable-Migrations -ContextProjectName MyProject.Repository -ContextTypeName MyProject.Repository.MyDbContext -ProjectName MyProject.Tests -StartUpProjectName MyProject.Tests -ConnectionStringName "MyConnectionString"
Add-Migration "Init Test Db"
Update-Database -ProjectName MyProject.Tests -StartUpProjectName MyProject.Tests -ConnectionStringName "MyConnectionString"