0

Overview:

I am working on ASP.NET MVC Project with Entity Framework's Code First approach for the database.

I recently automated the deployment process via VSO pipelines (Build & Release)

Problem:

  1. For Application Deployment it's perfect and working fine.
  2. For Database I am facing issues (explained below).

Details:

I read this, this and this but issues in these solutions are

  1. They are using Publish Profile setting, which would run the migration on application start event, which I don't want (not a best practice though)

  2. For others using Build Pipeline (copying (a) EF tools, (b) Dll's and (c) run migrate.exe via command line to run update-database command), and it will eventually run migrations on Successful Build. I rather want it to deploy changes on 'Successful Release'.

My Work

I moved step (c) from build to release pipeline. But it's not able to find the drop.

Secondly, How to roll back in case of a crash on production?

Can anyone suggest what the best approach to solving this scenario?

Danyal Malik
  • 198
  • 11

1 Answers1

1

In the case of crash on production, you can rollback database to previous version by running update-database -TargetMigration:"Migration_Name"

Khai Nguyen
  • 935
  • 5
  • 17