Skip to content

Commit

Permalink
Add deployment batch templates using custom create script
Browse files Browse the repository at this point in the history
  • Loading branch information
seif committed Sep 17, 2011
1 parent fdc5093 commit 65308cb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions db/SQLServer/TestRoundhousE/custom_db_create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
USE master
IF NOT EXISTS(SELECT * FROM sys.databases WHERE [name] = '{{DatabaseName}}')
BEGIN
CREATE DATABASE {{DatabaseName}}
END
15 changes: 15 additions & 0 deletions deployment/templates/DBDeployment.DropCustomCreate.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@echo off

SET DIR=%~d0%~p0%

SET database.name="${database.name}"
SET sql.files.directory="%DIR%${dirs.db}\SQLServer\${database.name}"
SET server.database="${server.database}"
SET repository.path="${repository.path}"
SET version.file="${file.version}"
SET version.xpath="//buildInfo/version"
SET environment=${environment}
SET custom.create.script="USE master;IF NOT EXISTS(SELECT * FROM sys.databases WHERE [name] = '{{DatabaseName}}')BEGIN; CREATE DATABASE {{DatabaseName}}; END;"

"%DIR%Console\rh.exe" /d=%database.name% /f=%sql.files.directory% /s=%server.database% /vf=%version.file% /vx=%version.xpath% /r=%repository.path% /env=%environment% /drop
"%DIR%Console\rh.exe" /d=%database.name% /f=%sql.files.directory% /s=%server.database% /cds=%custom.create.script% /vf=%version.file% /vx=%version.xpath% /r=%repository.path% /env=%environment% /simple
14 changes: 14 additions & 0 deletions deployment/templates/DBDeployment.DropCustomFileCreate.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@echo off

SET DIR=%~d0%~p0%

SET database.name="${database.name}"
SET sql.files.directory="%DIR%${dirs.db}\SQLServer\${database.name}"
SET server.database="${server.database}"
SET repository.path="${repository.path}"
SET version.file="${file.version}"
SET version.xpath="//buildInfo/version"
SET environment=${environment}

"%DIR%Console\rh.exe" /d=%database.name% /f=%sql.files.directory% /s=%server.database% /vf=%version.file% /vx=%version.xpath% /r=%repository.path% /env=%environment% /drop
"%DIR%Console\rh.exe" /d=%database.name% /f=%sql.files.directory% /s=%server.database% /cds=%sql.files.directory%\custom_db_create.sql /vf=%version.file% /vx=%version.xpath% /r=%repository.path% /env=%environment% /simple

0 comments on commit 65308cb

Please sign in to comment.