How to continuous deploy EF Migrations using Jenkins?

601 views Asked by At

I have been looking into continuous deployment of my .net code first MVC project. For that I have used github action and later pushing it to the server thugh FTP transfer.

I am doing RnDs on how can we carry out db migrations too, but I did not get much documentation on how to achieve it. Should I be using migrate.exe and try ways to execute it on server?

I came across dbforge plugin for jenkins, that can execute sql commands. But not good documentation on that too, hence here to ask if anyone has achieved continuous deployment and migration on db on git hub push?

Any reference or answer to this is highly appreciated and thanks in advanve

1

There are 1 answers

0
Jijo Nair On

I had carried out this process using dbForge tool which isn't free/opensource. You have to pay for the tool and its the only way to deploy code first ef migration. You can refer this link on how to configure dbForge plugin for jenkins, and there will be a plan to execute SQL scripts with it which is used to execute the sql statements/scripts.

The alternate way to execute any code first ef migration is running a C# script through msdeploy enter link description here. This approach however will require you to install/have SSIS development package. Write a c# script in SSIS package that will contain code to execute ef migration, and you can place it inside a SQL Job to execute once the deployment starts << this process is only for automating the EF migration and web package deployment sequentially. This is a lengthy process and requires a lot of testing. For more details I can email the functional and technical specs on how to configure this approach.

You can also place a SQL Job that executes a command line that updates EF migrations. This is only for applications that uses .net core version 6+. The link can be found here here