Making pre- and post-deployment scripts run in a VSTS DBPro build.

I'm going to be doing the keynote at the launch of Visual Studio Team Editor for Database Professionals (aka VSTS DBPro, “data dude”) tomorrow.  I wanted to play around with creating default values in lookup tables as part of my demo.  DBPro gives you this functionality through pre-deployment and post-deployment scripts.  You write your own script and that data gets inserted into the database.

Well, I kinda had some trouble getting that to work.  I created the post-deploy script and ran the build but the values weren't being inserted.  How do I make DBPro actually run my custom post-deployment scripts?

Not surprisingly, I missed something in the process.  I created the script but I didn't actually tell VSTS to run it.  There are two files that govern these pre- and post- scripts: Script.PreDeployment.sql and Script.PostDeployment.sql.  When you create a new script, you need to register it for execution inside of one of these config files.

Example: I've got a bunch of Restaurant Type lookup values that need to get set so I created a script called CreateRestaurantTypes.sql.  In order to make it run, I needed to edit Script.PostDeployment.sql and add the following line:

:r .\CreateRestaurantTypes.sql

That fixed it.  (duh.)

-Ben

 

-- Looking for consulting or training for Visual Studio Team System or Team Foundation Server?  Contact us via http://www.benday.com.

posted @ Wednesday, December 13, 2006 5:41 AM

Print

Comments on this entry:

# re: Making pre- and post-deployment scripts run in a VSTS DBPro build.

Left by Dan Christ at 1/26/2010 4:44 PM
Gravatar
Too bad this doesn't work in VSTS 2010 just keeps telling me I have Incorrect Syntax near ':'.

Any Ideas?

Your comment:



 (will not be displayed)


 
 
 
Please add 4 and 2 and type the answer here:
 

Live Comment Preview:

 
«March»
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910