Skip to content

Instantly share code, notes, and snippets.

@serbrech
Last active February 9, 2017 14:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serbrech/8333695 to your computer and use it in GitHub Desktop.
Save serbrech/8333695 to your computer and use it in GitHub Desktop.
Powershell roundhouse wrapper
function Invoke-Roundhouse {
param(
[alias("env")]$environment="LOCAL",
$server="(local)",
$dbName="DB"
)
$scriptPath = Split-Path (Get-PSCallStack)[1].ScriptName
write-host "base path : $scriptPath"
$sql_files_directory= Join-Path $scriptPath "db\DBScriptFolder"
$version_file = Join-Path $scriptPath "outBin\SomeVersioned.dll"
$roundhouse = "$scriptPath/tools/roundhouse/rh.exe"
$arguments = @();
$arguments += "-d `"$dbName`""
$arguments += "-f `"$sql_files_directory`""
$arguments += "-s `"$server`""
$arguments += "-vf `"$version_file`""
$arguments += "-env `"$environment`""
$arguments += "-simple"
$arguments += "--silent"
write-host "Exe : $roundhouse"
write-host "Arguments: $arguments"
$process = (Start-Process $roundhouse -ArgumentList $arguments -NoNewWindow -Wait -Passthru)
write-host "Process exited with code : " $process.ExitCode
if( $process.ExitCode -ne 0 ) {
throw "Oops! Something when wrong when running roundhouse !!!"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment