Red Gate forums :: View topic - Deploying dacpac files via SQL Database Projects (.sqlproj)
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation

Deployment Manager PowerShell Scripts forum

Deploying dacpac files via SQL Database Projects (.sqlproj)

Search in Deployment Manager PowerShell Scripts forum
Post new topic   Reply to topic
Jump to:  
Author Message
lee5i3



Joined: 16 Jul 2010
Posts: 38

PostPosted: Wed Jul 10, 2013 11:02 pm    Post subject: Deploying dacpac files via SQL Database Projects (.sqlproj) Reply with quote

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

Code:

$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/hh550080%28v=vs.103%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
Back to top
View user's profile Send private message
justin.caldicott



Joined: 20 Apr 2011
Posts: 55

PostPosted: Thu Jul 11, 2013 10:49 am    Post subject: Reply with quote

Thanks for sharing Lee, very useful!
_________________
Justin Caldicott
Product Manager - Deployment Manager
Red Gate
Back to top
View user's profile Send private message
lee5i3



Joined: 16 Jul 2010
Posts: 38

PostPosted: Thu Jul 11, 2013 6:12 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group