Working with Options and PowerShell

dbaduckdbaduck Posts: 2 Bronze 1
When I use the Options.Default things work OK, but I want to add an option IgnoreConstraintNames, but in PowerShell you can specify one or the other, but I need to know how you would do this when executing the CompareWith and want to combine multiple options.

You cannot do [RedGate.SqlCompare.Engine.Options]::Default + [RedGate.SqlCompare.Engine.Options]::IgnoreConstraintNames

because it gives you an error that there is no op_Add for this type of object.

Thanks.

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    I haven't done much powershell myself, but what you need to do is a "bitwise or" operation to append an option to the default options. Powershell defines an operator for this called -bor, so hopefully this works:
    ([RedGate.SqlCompare.Engine.Options]::Default -bor [RedGate.SqlCompare.Engine.Options]::IgnoreConstraintNames)
Sign In or Register to comment.