Advertisement
Guest User

Untitled

a guest
Jul 13th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. Write-Output "***************************"
  2. Write-Output "***** DEPLOY DATABASE *****"
  3. Write-Output "***************************"
  4.  
  5. # Configuration
  6. $pipeline = ${env:PIPELINE_NUMBER}.trim()
  7. $schemaComparePath = 'C:\\Program Files\\Red Gate\\Schema Compare for Oracle 3\\SCO.exe'
  8. $targetSchemaName = "MySchema_INTEGRATION"
  9. $schemaRelativePath = ""
  10. $tns = "MyTNS"
  11. $username = "MyUsername"
  12. $password = "YourReallyWantToPerameteriseAndEncryptThis-ButForThePoCIllLetYouOff"
  13. $sourceName = "MySchema"
  14. $extractedNuGetDirectory = "${env:Workspace}\ExtractedNuGet\${schemaRelativePath}{$sourceName}"
  15. $deploymentArtifactDirectory = "${env:Workspace}\artifacts\${pipeline}"
  16.  
  17. # Logging config variables for troubleshooting
  18. Write-Output "Using the following variables:"
  19. Write-Output "pipeline: $pipeline"
  20. Write-Output "schemaComparePath: $schemaComparePath"
  21. Write-Output "schemaRelativePath: $schemaRelativePath"
  22. Write-Output "targetSchemaName: $targetSchemaName"
  23. Write-Output "tns: $tns"
  24. Write-Output "username: $username"
  25. Write-Output "password: $password"
  26. Write-Output "sourceName: $sourceName"
  27. Write-Output "extractedNuGetDirectory: $extractedNuGetDirectory"
  28. Write-Output "deploymentArtifactDirectory: $deploymentArtifactDirectory "
  29.  
  30. # Deploy changes using Redgate Schema Compare for Oracle
  31. Write-Warning "Upgrading $targetSchemaName"
  32.  
  33. & $schemaComparePath -source $extractedNuGetDirectory -target "$username/$password@$tns{$targetSchemaName}" -deploy -scriptfile "${deploymentArtifactDirectory}\upgradeScript.sql" -report "${deploymentArtifactDirectory}\diffReport.html" -reporttype Simple -includeidentical | Out-Host
  34.  
  35. # Logging the Schema Compare exit code and path to artifacts
  36. Write-Output "Schema Compare for Oracle exited with code $lastExitCode"
  37. Write-Output "UpgradeScript and diff report created and saved to ${deploymentArtifactDirectory}"
  38.  
  39. # Exit code 61 is simply telling us there are differences that have been deployed.
  40. if( $lastExitCode -eq 61)
  41. {
  42. exit 0
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement