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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment