Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Write-Output "***************************"
- Write-Output "***** DEPLOY DATABASE *****"
- Write-Output "***************************"
- # Configuration
- $pipeline = ${env:PIPELINE_NUMBER}.trim()
- $schemaComparePath = 'C:\\Program Files\\Red Gate\\Schema Compare for Oracle 3\\SCO.exe'
- $targetSchemaName = "MySchema_INTEGRATION"
- $schemaRelativePath = ""
- $tns = "MyTNS"
- $username = "MyUsername"
- $password = "YourReallyWantToPerameteriseAndEncryptThis-ButForThePoCIllLetYouOff"
- $sourceName = "MySchema"
- $extractedNuGetDirectory = "${env:Workspace}\ExtractedNuGet\${schemaRelativePath}{$sourceName}"
- $deploymentArtifactDirectory = "${env:Workspace}\artifacts\${pipeline}"
- # Logging config variables for troubleshooting
- Write-Output "Using the following variables:"
- Write-Output "pipeline: $pipeline"
- Write-Output "schemaComparePath: $schemaComparePath"
- Write-Output "schemaRelativePath: $schemaRelativePath"
- Write-Output "targetSchemaName: $targetSchemaName"
- Write-Output "tns: $tns"
- Write-Output "username: $username"
- Write-Output "password: $password"
- Write-Output "sourceName: $sourceName"
- Write-Output "extractedNuGetDirectory: $extractedNuGetDirectory"
- Write-Output "deploymentArtifactDirectory: $deploymentArtifactDirectory "
- # Deploy changes using Redgate Schema Compare for Oracle
- Write-Warning "Upgrading $targetSchemaName"
- & $schemaComparePath -source $extractedNuGetDirectory -target "$username/$password@$tns{$targetSchemaName}" -deploy -scriptfile "${deploymentArtifactDirectory}\upgradeScript.sql" -report "${deploymentArtifactDirectory}\diffReport.html" -reporttype Simple -includeidentical | Out-Host
- # Logging the Schema Compare exit code and path to artifacts
- Write-Output "Schema Compare for Oracle exited with code $lastExitCode"
- Write-Output "UpgradeScript and diff report created and saved to ${deploymentArtifactDirectory}"
- # Exit code 61 is simply telling us there are differences that have been deployed.
- if( $lastExitCode -eq 61)
- {
- exit 0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement