Skip to content

Commit

Permalink
Merging
Browse files Browse the repository at this point in the history
  • Loading branch information
colindembovsky committed Oct 3, 2016
2 parents bc8b9e4 + 5e4d0af commit c14834b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
12 changes: 7 additions & 5 deletions Tasks/DacPacReport/DacPacReport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Trace-VstsEnteringInvocation $MyInvocation
$dropName = Get-VstsInput -Name "dropName" -Require
$targetDacpacPath = Get-VstsInput -Name "targetDacpacPath" -Require
$dacpacName = Get-VstsInput -Name "dacpacName" -Require
$extraArgs = GEt-VstsInput -Name "extraArgs"

function Get-LatestBuild {
param(
Expand Down Expand Up @@ -122,25 +123,26 @@ function New-Report {
param(
[string]$SlPackagePath,
[string]$SourceDacpac,
[string]$TargetDacpac
[string]$TargetDacpac,
[string]$ExtraArgs
)

$SourceDacpac = Resolve-Path -Path $SourceDacpac
$TargetDacpac = Resolve-Path -Path $TargetDacpac

Write-Verbose "Generating report: source = $SourceDacpac, target = $TargetDacpac"
$commandArgs = "/a:{0} /sf:`"$SourceDacpac`" /tf:`"$TargetDacpac`" /tdn:Test /op:`"{1}`""
$commandArgs = "/a:{0} /sf:`"$SourceDacpac`" /tf:`"$TargetDacpac`" /tdn:Test /op:`"{1}`" {2}"

if (-not (Test-Path -Path "./SchemaCompare")) {
mkdir "SchemaCompare"
}

$reportArgs = $commandArgs -f "DeployReport", "./SchemaCompare/SchemaCompare.xml"
$reportArgs = $commandArgs -f "DeployReport", "./SchemaCompare/SchemaCompare.xml", $ExtraArgs
$reportCommand = "`"$SqlPackagePath`" $reportArgs"
$reportCommand
Invoke-Command -command $reportCommand

$scriptArgs = $commandArgs -f "Script", "./SchemaCompare/ChangeScript.sql"
$scriptArgs = $commandArgs -f "Script", "./SchemaCompare/ChangeScript.sql", $ExtraArgs
$scriptCommand = "`"$SqlPackagePath`" $scriptArgs"
$scriptCommand
Invoke-Command -command $scriptCommand
Expand Down Expand Up @@ -209,7 +211,7 @@ if ($compareBuild -ne $null) {
if ($targetDacpac -ne $null) {
Write-Verbose -Verbose "Found target dacpac $($targetDacpac)"

New-Report -SqlPackagePath $SqlPackagePath -SourceDacpac $sourceDacpac -TargetDacpac $targetDacpac
New-Report -SqlPackagePath $SqlPackagePath -SourceDacpac $sourceDacpac -TargetDacpac $targetDacpac -ExtraArgs $extraArgs

$reportPath = ".\SchemaCompare\SchemaCompare.xml"
Convert-Report
Expand Down
1 change: 1 addition & 0 deletions Tasks/DacPacReport/TestScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ $env:SYSTEM_DEFINITIONID=9 # FabFiberExpress-DACPAC
$env:INPUT_DROPNAME="drop"
$env:INPUT_DACPACNAME="fabFiber.Schema"
$env:INPUT_TARGETDACPACPATH="C:\mData\ws\col\dac"
$env:INPUT_EXTRAARGS="/v:Hello=Bye"

# invoke the script
Invoke-VstsTaskScript -ScriptBlock { . .\DacPacReport.ps1 } -Verbose
22 changes: 19 additions & 3 deletions Tasks/DacPacReport/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@
"sqlpackage"
],
"version": {
"Major": "0",
"Minor": "0",
"Patch": "2"
"Major": "1",
"Minor": "1",
"Patch": "31"
},
"minimumAgentVersion": "1.103.0",
"instanceNameFormat": "DacPac Schema Compare $(dacpacName).dacpac",
"groups": [
{
"name": "advanced",
"displayName": "Advanced",
"isExpanded": false
}
],
"inputs": [
{
"name": "dropName",
Expand All @@ -44,6 +51,15 @@
"defaultValue": "",
"required": true,
"helpMarkDown": "Path to find the target dacpac (typically the artifact staging path where the dacpac will be uploaded from)."
},
{
"name": "extraArgs",
"type": "string",
"label": "Extra SQLPackage args",
"defaultValue": "",
"required": false,
"helpMarkDown": "Extra args to use for running the SQLPackage.exe schema compare command.",
"groupName": "advanced"
}
],
"execution": {
Expand Down

0 comments on commit c14834b

Please sign in to comment.