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?

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

Left by Steve MunLeeuw at 3/29/2010 4:42 PM
Gravatar
I can reproduce the same issue with VS 2010 RC

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

Left by Dan at 6/11/2010 11:08 AM
Gravatar
I have the same problem using VS2010 Ultimate. Does anyone know how to correct this?

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

Left by moyz at 7/7/2010 7:29 PM
Gravatar
You added file CreateRestaurantTypes might have something which db pro doen't like it. Like go or 3 or 4 part object naming. try removing that stuff

Your comment:



 (will not be displayed)


 
 
 
Please add 1 and 1 and type the answer here:
 

Live Comment Preview:

 
«September»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789