Permalink
Browse files

Add deployment batch templates using custom create script

  • Loading branch information...
1 parent fdc5093 commit 65308cb9108b381d55a46c194d27d2baa7266fd5 @seif seif committed Sep 17, 2011
@@ -0,0 +1,5 @@
+USE master
+IF NOT EXISTS(SELECT * FROM sys.databases WHERE [name] = '{{DatabaseName}}')
+BEGIN
+ CREATE DATABASE {{DatabaseName}}
+END
@@ -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
@@ -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.