asp core ef migrations on production server

asp.net-core entity-framework entity-framework-core

Question

Can't perform migrations on production server. Command "dotnet ef database update" works on my computer but fails on production Steps i tried are: 1. Fill in checkbox execute code first migrations in Visual Studio before publish. 2. dotnet ef database update not working . I installed .NET SDK but it doesn't have libraries needed.

Any suggestions appeciated.

1
5
10/17/2016 7:28:18 AM

Accepted Answer

There are a couple options:

  1. Generate a SQL script using dotnet ef migrations script and run it on your production database.
  2. Call dbContext.Database.Migrate() at runtime during application startup (but be careful when running multiple apps/database clients)

Also, in the next release (1.0.0-preview3) of Microsoft.EntityFrameworkCore.Tools, we'll be shipping ef.exe which you can point directly to assemblies (instead of project.json files) to perform migrations.

12
10/17/2016 3:39:54 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow