Skip to content

Commit

Permalink
Update-SQL - Adding -NoPSTypeName (Fixes #15)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Mar 29, 2023
1 parent 73021ae commit 535d997
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Commands/SQL/Update-SQL.ps1
Expand Up @@ -131,7 +131,13 @@ function Update-Sql
# If you ignore script properties (and the table includes the PSTypeName column), they will automatically be reconstructed in PowerShell.
# This can reduce storage space, but will prevent non-PowerShell clients from seeing the properties
[Switch]
$IgnoreScriptProperty
$IgnoreScriptProperty,

# If set, will not attempt to create or set a PSTypeName column.
# The PSTypeName column is used to decorate data returned from Select-SQL, allowing it to act as PowerShell objects that can be formatted and extended.
[Alias('NoDecoration','NoDecorate')]
[switch]
$NoPSTypeName
)


Expand Down Expand Up @@ -340,12 +346,12 @@ function Update-Sql
}


if ($Force) {
if ($Force -and -not $NoPSTypeName) {
if ($haspstypename -or ($PropertyList -and $propertyList -notcontains 'pstypename') -or
($object.pstypenames[0] -like "*.PSCustomObject" -or
$object.pstypenames[0] -like "*Selected.*")) {
} else {
New-Object PSObject -Property @{
[PSCustomObject]@{
Name="pstypename"
Value = $object.pstypenames -join '|'
SqlType = if ($UseSQLCompact) {
Expand Down

0 comments on commit 535d997

Please sign in to comment.