Pre-Model Scripts

Richie Lee discusses what makes for a good pre-model script in an SSDT project:

Idempotent: big word, and is used in maths. But don’t let that put you off. What it means in this context is that a script can be re-run and the same result happens. So in the context of altering a primary key, the pseudo-code would look something like this:

if database exists then
if table exists then
if primary key name eq “oldname” then
drop primary key then
add primary key with “newname”

I’m a huge fan of idempotent scripts.  Releases become so much easier when you can guarantee that you can re-run the scripts, and idempotence is a necessary property of continuous integration.

Related Posts

CI With SQL Server And Jenkins

Chris Adkin shows how to auto-deploy SQL Server Data Tools projects to a SQL Server instance using Jenkins: The aim of this blog post is twofold, it is to explain how: A “Self building pipeline” for the deployment of a SQL Server Data Tools project can be implemented using open source tools A build pipeline can be […]

Read More

Continuous Deployment In A Box

Ed Elliott has been working on a very interesting project: What does this do? Unblock-File *.ps1 – removes a flag that windows puts on files to stop them being run if they have been downloaded over the internet. .\ContinuousDeploymentFTW.ps1 – runs the install script which actually: Downloads chocolatey Installs git Installs Jenkins 2 Guides you […]

Read More

Categories

October 2016
MTWTFSS
« Sep Nov »
 12
3456789
10111213141516
17181920212223
24252627282930
31