Skip to content

Commit 830627a

Browse files
Compare-DbaDbSchema - Fix DACPAC-to-DACPAC comparison and Type field
- Add /tdn: argument when comparing two DACPAC files (sqlpackage requires a target database name even for offline DACPAC-to-DACPAC comparisons) - Strip 'Sql' prefix from Type field (sqlpackage returns 'SqlTable' etc. but 'Table' is cleaner for end users and matches test expectations) (do Compare-DbaDbSchema) Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
1 parent 321ef38 commit 830627a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

public/Compare-DbaDbSchema.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ function Compare-DbaDbSchema {
161161
$sqlPackageArgs += " /tcs:""$connStringEscaped"""
162162
$targetDescription = "$($targetServer.DomainInstanceName)\$TargetDatabase"
163163
} else {
164-
$sqlPackageArgs += " /tf:""$TargetPath"""
164+
$targetDbName = [System.IO.Path]::GetFileNameWithoutExtension($TargetPath)
165+
$sqlPackageArgs += " /tf:""$TargetPath"" /tdn:""$targetDbName"""
165166
$targetDescription = $TargetPath
166167
}
167168

@@ -212,12 +213,13 @@ function Compare-DbaDbSchema {
212213
foreach ($operation in $report.DeploymentReport.Operations.Operation) {
213214
$operationName = $operation.Name
214215
foreach ($item in $operation.Item) {
216+
$objectType = $item.Type -replace "^Sql", ""
215217
$outputObject = [PSCustomObject]@{
216218
SourcePath = $sourcePathFull
217219
Target = $targetDescription
218220
Operation = $operationName
219221
Value = $item.Value
220-
Type = $item.Type
222+
Type = $objectType
221223
}
222224

223225
if ($KeepReport) {

0 commit comments

Comments
 (0)