Testing Entity Framework Core Migrations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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