Skip to content

Instantly share code, notes, and snippets.

@jessebarocio

jessebarocio/test.cs Secret

Last active Oct 10, 2017
Embed
What would you like to do?
Testing Entity Framework Core Migrations
var dbContext = new MyDbContext();
// Update to latest migration
dbContext.Database.Migrate();
// Roll back all migrations. NOTE: This is not part of EF Core's public API. Use at your own risk.
var migrator = dbContext.GetInfrastructure().GetRequiredService<IMigrator>();
migrator.Migrate(Migration.InitialDatabase);
// Update back to the latest migration
dbContext.Database.Migrate();
Update-Database
Update-Database -Migration 0
Update-Database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.