How to migrate DB without nuget? It is not possible to use Visual Studio with nuget in production environment. Currently, many examples only teach us to use Visual Studio with nuget. How to use the generated DbMigration classes?
The easiest way is:
Database.SetInitializer( new MigrateDatabaseToLatestVersion<MyDbContext, MyDbMigrationsConfiguration>());
This will run the migrations when initializing the DbContext.
You can also force the execution manually:
var migrator = new DbMigrator(new MyMigrationsConfiguration()); migrator.Update();
(I believe you also have to set
TargetDatabase on the configuration, but you can try)
Here are the options: