Database Change Management
Database Change Management
Home | Profile | Register | Active Topics | Active Polls | Members | Private Messages | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?




 All Forums
 Support
 DB Ghost Support Forum
 NAnt Targets for DBGhost
 New Topic  New Poll New Poll
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

indomitablehef


2 Posts

Posted - 03/26/2008 :  12:36:05  Show Profile  Visit indomitablehef's Homepage Send indomitablehef a Private Message  Reply with Quote


	
		
	
	
	<!-- These properties go at the top of your .build file and/or in your local.properties.xml file -->
	<property name="project.root" value="c:\root\development\projects\myproject" />
	<property name="dbghost.path" value="C:\Program Files\DB Ghost" />
	<property name="builder.template.db" value="My_Template_Database" />
	<property name="builder.template.server" value="(local)" />
	<property name="scripter.database.server" value="(local)" />
	<property name="changemanager.database.server" value="(local)" />
	<property name="application.database" value="MyProject_DB" />

	
	<!-- replaceable tokens -->
	<!- basically, you save your xml settings files with a ".xml.template" filename extension (buildersettings.xml.template, for example)
	    Then inside each settings file, you replace the paths and database names with tokens, with this format: @TOKEN_NAME@.
		For example, replace all occurences of "c:\root\development\projects\myproject" with @PROJECT_ROOT@
		When this convert.template target is called, it will copy buildersettings.xml.template to buildersettings.xml and replace the tokens with
		the property values defined in your .build  or local.properties.xml file	
	-->
	<target name="convert.template">
		<copy file="${target}.template" tofile="${target}" overwrite="true">
		    <filterchain>
			<replacetokens>
				<token key="PROJECT_ROOT" value="${project.root}" />
				<token key="APPLICATION_DATABASE" value="${application.database}" />
				<token key="BUILDER_TEMPLATE_DB" value="${builder.template.db}" />
				<token key="BUILDER_TEMPLATE_SERVER" value="${builder.template.server}" />
				<token key="SCRIPTER_DATABASE_SERVER" value="${scripter.database.server}" />
				<token key="CHANGEMANAGER_DATABASE_SERVER" value="${changemanager.database.server}" />						
				</replacetokens>
		    </filterchain>
		</copy>
	 </target>
	
	<!-- DBGhost Targets: dbghost.builder.build, dbghost.changemanager.sync, dbghost.scripter.script -->
	
	<!-- DGhost Builder target -->
	<!-- first calls convert.template on the builder.settings.xml file, passed in as property value.
		 Then, it executes buildercmd.exe against the buildersettings.xml file	
	-->
	<target name="dbghost.builder.build">    
		<property name="target" value="${builder.settings.xml}" />
		<call target="convert.template" />		
		
		<exec basedir="${dbghost.path}"
              useruntimeengine="true"
              workingdir="${dbghost.path}"
              program="buildercmd.exe"
              commandline=""${builder.settings.xml}"" />                          
    </target>
	
	<!-- DGhost Changemanager target -->
	<!-- first calls convert.template on the changemanager.settings.xml file, passed in as property value.
		 Then, it executes changemanagercmd.exe against the changemanagersettings.xml file	
	-->
    <target name="dbghost.changemanager.sync">    
		<property name="target" value="${changemanager.settings.xml}" />
        <call target="convert.template" />		
		
		<exec basedir="${dbghost.path}"
              useruntimeengine="true"
              workingdir="${dbghost.path}"
              program="changemanagercmd.exe"
              commandline=""${changemanager.settings.xml}"" />                          
    </target>
	
	<!-- DGhost Scripter target -->
	<!-- first calls convert.template on the scripter.settings.xml file, passed in as property value.
		 Then, it executes ScripterCmd.exe against the changemanagersettings.xml file	-->	
	<target name="dbghost.scripter.script">    
		<property name="target" value="${scripter.settings.xml}" />
        <call target="convert.template" />		
		
		<exec basedir="${dbghost.path}"
              useruntimeengine="true"
              workingdir="${dbghost.path}"
              program="ScripterCmd.exe"
              commandline=""${scripter.settings.xml}"" />                         
    </target>
	
	<!-- end DBGhost Targets -->
	
	<!-- examples of calling DBGhost Targets -->
	
	<!-- builder example -->
	<target name="dbghost.build.myProject_db>
	    <property name="builder.settings.xml" value="${project.root}\db\myProject_db\buildersettings.xml" />
		<call target="dbghost.builder.build" />      
	</target>

	<!-- changemanager example -->
	<target name="dbghost.sync.myProject_db">
		<property name="changemanager.settings.xml" value="${project.root}\db\myProject_db\changemanagersettings.xml" />
		<call target="dbghost.changemanager.sync" />
	</target>

	<!-- scripter example -->
	<target name="dbghost.script.myProject_db">
	    <property name="scripter.settings.xml" value="${project.root}\db\myProject_db\scriptersettings.xml" />
		<call target="dbghost.scripter.script" />
	</target>
	


You must be logged in to see this link.

Google AdSense

USA
Mountain View


leachm



125 Posts

Posted - 03/26/2008 :  15:13:35  Show Profile  Click to see leachm's MSN Messenger address Send leachm a Private Message  Reply with Quote
Hi,

Thanks for the post - do you use DB Ghost in your build process?

regards,

Malcolm Leach
You must be logged in to see this link.
DB Ghost Build, Compare and Synchronize = Change Management for SQL Server
Go to Top of Page

indomitablehef



2 Posts

Posted - 03/26/2008 :  15:17:29  Show Profile  Visit indomitablehef's Homepage Send indomitablehef a Private Message  Reply with Quote
Just getting started, yes. I'm storing the DBGhost scripts (and my .net app source code) in SubVersion, and using CruiseControl.Net and NAnt to do continuous integration. And as of today, I'm calling DBGhost from NAnt to build/sync the database on our first production application.

You must be logged in to see this link.
Go to Top of Page

leachm



125 Posts

Posted - 03/26/2008 :  15:22:30  Show Profile  Click to see leachm's MSN Messenger address Send leachm a Private Message  Reply with Quote
Cool - let me know how it goes and any other thoughts you might have on the whole continuous integration process and how DB Ghost has fitted in :)

regards,

Malcolm Leach
You must be logged in to see this link.
DB Ghost Build, Compare and Synchronize = Change Management for SQL Server
Go to Top of Page

leachm



125 Posts

Posted - 07/01/2008 :  15:32:28  Show Profile  Click to see leachm's MSN Messenger address Send leachm a Private Message  Reply with Quote
A quick update on this post - the BuilderCMD.exe no longer exists as all the functionality has been rolled into the ChangeManagerCmd.exe so you just need to replace it in the XML.

regards,

Malcolm Leach
You must be logged in to see this link.
DB Ghost Build, Compare and Synchronize = Change Management for SQL Server
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  New Poll New Poll
 Reply to Topic
 Printer Friendly
Jump To:
Database Change Management © Copyright 2005 Innovartis Ltd. Go To Top Of Page
Snitz Forums 2000
RSS Feed 1 RSS Feed 2
Powered by ForumCo 2000-2008
TOS - AUP - URA - Privacy Policy
ForumCo Free Blogs and Galleries
Signup for a free forum or Go Banner Free