How can we help you today? How can we help you today?
BenT
Hi Dan, I think there is nothing confidential in the code I already adapted from a Red-Gate employee post. Please find the code below: Database build from Source Control db folder synchronized: -------------------------------------------------------------------------------- <# -------Create a build artifact from source control --------#> [String]$path ="$(Build.SourcesDirectory)\DataBases\EDW" [String]$packageVersion = "$(Build.BuildId)" [String]$packageID = "EDW_pkg"    [String]$buildArtifactPath = "$(Build.ArtifactStagingDirectory)"     $path |   New-DatabaseProjectObject | #wrap up the script and create a build artefact    New-DatabaseBuildArtifact -PackageId $packageID -PackageVersion $packageVersion `      -PackageDescription 'EDW scripts' | # and save it as a file         Export-DatabaseBuildArtifact `           -Path $buildArtifactPath Database deployment: ------------------------------- <# -------Create a release artefact from a build package --------#> [String]$currentEnv =[System.Environment]::GetEnvironmentVariable('RELEASE_ENVIRONMENTNAME') [String]$deployDataBase_YesNo ="$(DeployDatabase_Y_N)" if ( $currentEnv -ne 'Development' )  #do no deploy to dev DB EDW, already synchronized { if ( $deployDataBase_YesNo.ToUpper() -eq 'Y' ) #deploy when user put "Y" (Yes) in variable { [String]$packageVersion = "$(Build.BuildId)"    [String]$buildArtifactPath = "$(System.ArtifactsDirectory)\$(Release.PrimaryArtifactSourceAlias)\drop\EDW_pkg.$packageVersion.nupkg" [String]$targeServerDB = "$(SQLConnectionString)$(SQLDataBase)" [String]$ReleasesPath = "$(System.ArtifactsDirectory)\$(Release.PrimaryArtifactSourceAlias)\drop\DB_Releases\EDW\$(ReleaseFolder)\$(Release.ReleaseName)" [String]$BuildReportPath = "C:\BusinessIntelligence\ExportReleases\$(Release.DefinitionName)\$(Release.ReleaseId)_$(Release.ReleaseName)\$(ReleaseFolder)\BuildReport.html" [String]$options = "IncludeDependencies,NoTransactions" $iReleaseArtifact=New-DatabaseReleaseArtifact   ` -Source $buildArtifactPath    ` -Target $targeServerDB    ` -SQLCompareOptions $options   Use-DatabaseReleaseArtifact $iReleaseArtifact    ` -DeployTo $targeServerDB   ` -SkipPostUpdateSchemaCheck   ` -QueryBatchTimeout 900 $iReleaseArtifact.ReportHtml>$BuildReportPath start $BuildReportPath } } Regards, Ben / comments
Hi Dan,I think there is nothing confidential in the code I already adapted from a Red-Gate employee post.Please find the code below:Database build from Source Control db folder synchronized:-------...
0 votes