Usage of Placeholders

Feb 9, 2009 at 5:50 AM
Edited Feb 9, 2009 at 5:52 AM
I've been using SQL Server Runner for the past 4 months and find it to be a very useful tool.  I recently saw that "Placeholders" were included and thought that they could make my deployments to other environments nice and easy... unfortunately they don't seem to.

Here's how I'd like them to work... :o)

My application, named "Foo", exists within 3 environments DEV, UAT and PROD.  The deployment guys for UAT and PROD like to know that the scripts run in PROD are exactly the same scripts as those run in UAT  (Except where environment specific values need to be changed (currently done using find and replace)).

The database contains a config table that contains name value pairs.  DEV might contain:
LogPath \\devserver\Foo\Logs
Environment Development
Uploads \\devserver\uploads

UAT might contain:
LogPath \\uatserver\Foo\Logs
Environment User Acceptance
Uploads \\uatserver\uploads

I'd like to make my scripts like this:
LogPath ${LogPath}
Environment ${Environment}
Uploads ${Uploads}

If Placeholders were stored in .sqlrunner files I could create a sqlrunner file for each environment, each file would contain the values specific to that environment.  I can then have a batch file for each environment.

I'm not sure how PlaceHolders are intended to work in their current implementation?  I looked at the example in the documentation and it seemed that to move from dev to test you would still need to change your sql scripts to reference _SERVER_02_ instead of _SERVER_01_

I'm happy to do some work on this if you (the project owner) are interested?

Feb 10, 2009 at 6:54 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Feb 10, 2009 at 6:55 AM
The feature you are suggesting it is very much in line what we envisaged. We would be very happy if you want to join the project, the more people the better. For the moment, why don't you get the latest code and have a look at how it works? Let us know how you are getting on and we give you a hand if you need any help. In the mean time, I will create a new ticket re this new feature.

If you install the VS Team Foundation client, have a look at CS#28267, this is when the place holder functionality was introduced so it may help you to understand how it works and eventually what changes are required.

The new ticket is [workitem:12582]

Thanks for using SQLRunner.