Skip to content

Commit 227c9bb

Browse files
committed
Invoke-DbaDbDataMasking - some changes from code review
1 parent ad2ff05 commit 227c9bb

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ allcommands.ps1
5252
.aider/aider.chat.history.md
5353
.aider/aider.input.history
5454
.aider/aider.llm.history
55-
**/.claude/settings.local.json

private/functions/Convert-DbaMaskingValue.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ function Convert-DbaMaskingValue {
111111
} else {
112112
switch ($DataType.ToLower()) {
113113
{ $_ -in 'bit', 'bool' } {
114-
if ($item -match "^[0-1]$") {
114+
if ($item -match "^[01]$") {
115115
$newValue = "$item"
116-
} elseif ($item -in "True", "true", "TRUE") {
116+
} elseif ($item -eq "true") {
117117
$newValue = "1"
118-
} elseif ($item -in "False", "false", "FALSE") {
118+
} elseif ($item -eq "false") {
119119
$newValue = "0"
120120
} else {
121121
$errorMessage = "Value '$($item)' is not valid BIT or BOOL"

public/Invoke-DbaDbDataMasking.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -961,10 +961,8 @@ function Invoke-DbaDbDataMasking {
961961
if ($columnobject.ColumnType -in 'decimal') {
962962
$newvalue = "0.00"
963963
}
964-
$convertedValue = Convert-DbaMaskingValue -Value $newvalue -DataType $columnobject.ColumnType -Nullable:$columnobject.Nullable -EnableException
965-
} else {
966-
$convertedValue = Convert-DbaMaskingValue -Value $newValue -DataType $columnobject.ColumnType -Nullable:$columnobject.Nullable -EnableException
967964
}
965+
$convertedValue = Convert-DbaMaskingValue -Value $newValue -DataType $columnobject.ColumnType -Nullable:$columnobject.Nullable -EnableException
968966

969967
if ($convertedValue.ErrorMessage) {
970968
$maskingErrorFlag = $true

0 commit comments

Comments
 (0)