EF Migrations on the CI Build Server

I run migrations in Visual Studio Package Manager. I am currently developing CI for our project. I was wondering how you can update the database from CI (since you are not in Visual Studio). Do I need to find the powershell.exe file and execute this?

Ps. I am using Teamcity for CI.

+7
source share
1 answer

You can use migrate.exe to transfer the database outside of Visual Studio. It is located in the packages/EntityFramework.xxx/tools folder.

The tool has some rough edges that you need to know about.

  • Make sure EntityFramework.dll and migrate.exe are in the same directory
  • You will probably need to specify the startUpDirectory parameter. Point it to the output directory of your application.

You can also write your own tools, the Update-Database command relies on the Update method on DbMigrator .

+6
source

All Articles