Answers: <p>There are a few different things you can do:</p>
  
  <ol>
  <li>In your CI process, run your new SQL update scripts against a <a href="https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-linux-2017&amp;pivots=cs1-bash" rel="nofollow noreferrer">Dockerized SQL Server</a>. This will allow your CI server to reject the changes if there are basic errors in the script.</li>
  <li>If you are fully containerized look into tools like <a href="https://kubernetes.io" rel="nofollow noreferrer">Kubernetes</a>.  These tools have ways to handle <a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/" rel="nofollow noreferrer">rolling back failed production updates</a>.</li>
  <li>Utilize a <a href="https://www.martinfowler.com/bliki/BlueGreenDeployment.html" rel="nofollow noreferrer">Blue Green Deployment</a> strategy along with integration testing.  This provides a fallback in case things go wrong and allows for different types of automated testing schemes in your CI process.</li>
  </ol>
  
Answers: CC BY-SA 4.0
Answers: 2019-10-09T15:22:05.117Z
Answers: 2019-10-09T15:22:05.117Z
Answers: Wesley Rolnick
Body: <p>How we can manage database part in DevOps environment/CICD pipeline, Here taking about the SQL Script. For Example any deployment where Insert and Update SQL's, If we setup in CICD pipeline then I will execute everytime thus I will re-execute everytime &amp; DevOps scenarios are fail in this situation.</p>
  
  <p>Overall How we can setup pipeline with SQL script and Application in real world and In case of rollback, How can we manage it ?</p>
  
Tags: <jenkins><continuous-integration><jenkins-pipeline><continuous-deployment><sql>
Title: How to deploy SQL Script in DevOps culture and Rollback situation too?
UserDisplayName: Nullpointer
ThreadText: # How to deploy SQL Script in DevOps culture and Rollback situation too?
  
  (Asked by: username_0 on 2019-10-08)
  
  How we can manage database part in DevOps environment/CICD pipeline, Here taking about the SQL Script. For Example any deployment where Insert and Update SQL's, If we setup in CICD pipeline then I will execute everytime thus I will re-execute everytime & DevOps scenarios are fail in this situation.
  
  Overall How we can setup pipeline with SQL script and Application in real world and In case of rollback, How can we manage it ?
  
  **Tags:** jenkins, continuous-integration, jenkins-pipeline, continuous-deployment, sql
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-10-09. Score: 2
  
  There are a few different things you can do:
  
  1. In your CI process, run your new SQL update scripts against a [Dockerized SQL Server](https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-linux-2017&pivots=cs1-bash). This will allow your CI server to reject the changes if there are basic errors in the script.
  2. If you are fully containerized look into tools like [Kubernetes](https://kubernetes.io). These tools have ways to handle [rolling back failed production updates](https://kubernetes.io/docs/tutorials/kubernetes-basics/update/update-intro/).
  3. Utilize a [Blue Green Deployment](https://www.martinfowler.com/bliki/BlueGreenDeployment.html) strategy along with integration testing. This provides a fallback in case things go wrong and allows for different types of automated testing schemes in your CI process.
  
  
  ---
  
  