Continuous Integration and the Automated Database Update Process

[article]

                             </items>

                      </in>

                      <do failonerror="true">

                             <if test="${runsql=='true'}" >

                                    <echo message="Running Script ${sqlscriptname}" />

                                    <echo message="sqlcmd -S ${sql.server} -d ${sql.database} -U ${sql.user} -P ${sql.password} -i ${sqlscriptname} -I" />   

                                    <exec failonerror="true" program="${sqlcmd.exe}" commandline='-b -S ${sql.server} -d ${sql.database} -U ${sql.user} -P ${sql.password} -i "${sqlscriptname}" -I' />

                                    <property name="HasSQLScriptRun" value="true" />                                                      

                             </if> 

                      </do>

              </foreach>   

       </target>

       <target name="runpostsql" >

              <!-- run post-deploys -->

              <foreach item="File"  property="sqlscriptname" >

                      <in>

                             <items basedir="${sql.scriptsourcepath}">

                                    <include name="**\Post**.sql" />   

                                    <exclude name="**\Pre-**" />

                             </items>

                      </in>

                      <do failonerror="true">             

                             <if test="${runsql=='true'}" >

                                    <echo message="Running Script ${sqlscriptname}" />

                                    <echo message="sqlcmd -S ${sql.server} -d ${sql.database} -U ${sql.user} -P ${sql.password} -i ${sqlscriptname} -I" />   

                                    <exec failonerror="true" program="${sqlcmd.exe}" commandline='-b -S ${sql.server} -d ${sql.database} -U ${sql.user} -P ${sql.password} -i "${sqlscriptname}" -I' />

                                    <property name="HasSQLScriptRun" value="true" />                            

                             </if>

                      </do> 

              </foreach>   

       </target>

       <target name="syncdbs" depends="runpresql,movePrePostDeployFoldersOut,comparesyncdbs,movePrePostDeployFoldersBack,runpostsql" >

              <!--   This will only set the sequence of target execution through the depends -->

              <call target="updateversion" />

       </target>     

</project>

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, TechWell.com is the place to go for what is happening in software development and delivery.  Join the conversation now!

Upcoming Events

Sep 22
Sep 24
Oct 12
Nov 09