Deploying dacpac files via SQL Database Projects (.sqlproj)

Share your PowerShell scripts for Deployment Manager

Moderators: Mike Upton, justin.caldicott, csmith, chirayu, DavidSimner

Deploying dacpac files via SQL Database Projects (.sqlproj)

Postby lee5i3 » Wed Jul 10, 2013 11:02 pm

This is in a "Deploy.ps1" in the root of my Database project

Code: Select all
$path = Split-Path -Parent $MyInvocation.MyCommand.Path

& "C:\\Program Files (x86)\\Microsoft SQL Server\\110\\DAC\\bin\\SqlPackage.exe" /sf:$path"\\bin\\Release\\MyProject.Database.dacpac" /a:publish /TargetConnectionString:$DBConnectionString /p:VerifyDeployment=true /p:CreateNewDatabase=$CreateNewDatabase | Out-Default


Note:
You will need to add a CreateNewDatabase variable so database can be recreated depending on the environment.. eg. Development re-creates DB but not production

There is a lot more options available as well..
http://msdn.microsoft.com/en-us/library ... 03%29.aspx

This is definitely not perfect, as I want to make it a bit more flexible on the paths, but it works great on my environment
lee5i3
 
Posts: 38
Joined: Fri Jul 16, 2010 9:26 pm

Postby justin.caldicott » Thu Jul 11, 2013 10:49 am

Thanks for sharing Lee, very useful!
Justin Caldicott
Product Manager - Deployment Manager
Red Gate
justin.caldicott
 
Posts: 55
Joined: Wed Apr 20, 2011 5:42 pm

Postby lee5i3 » Thu Jul 11, 2013 6:12 pm

Np,

This made Deployment Manager extremely useful,
I am able to have this setup with TeamCity and TFS.

So ZERO user interaction is required to deploy to our development server, which is hosted in a Windows Azure VM, all we need to do is check-in code, and it automatically deploys not only our code, as well as any database changes (which is a SQL Project within VS)

And when we want our sprints released, all we do is redeploy the last development release to next environment.

I'm totally sold on this!
lee5i3
 
Posts: 38
Joined: Fri Jul 16, 2010 9:26 pm


Return to Deployment Manager PowerShell Scripts

Who is online

Users browsing this forum: No registered users and 0 guests