How to set DriftOptionBlockDataLoss when using Powershell cmdlets
CopperStarSystems
Posts: 10 New member
We are using the Sql Change Automation Powershell cmdlets in our build/release pipeline on a VSTS Hosted VS2017 agent.
We have a recent commit that drops a column from an existing table, however when we execute the New-DatabaseReleaseArtifact cmdlet, it fails with this warning:
Drift analysis: These changes will NOT be applied because DriftOptionBlockDataLoss=True (see 'C:\Users\VssAdministrator\AppData\Local\Temp\DLM Automation\stqvpuxg.zsb\artifacts\[REDACTED]_DriftSyncScript.sql' for details). Changes have been detected that could result in data loss for the following table object(s): [REDACTED].
Is there a way to specify the DriftOptionBlockDataLoss variable when invoking this cmdlet?
Thanks!
Best Answer
-
Jessica R Posts: 1,319 Rose Gold 4Hi @CopperStarSystems!
You can workaround this issue by adding the<DriftOptionBlockDataLoss>False</DriftOptionBlockDataLoss>
tag to your .sqlproj file.
Answers
Jessica Ramos | Product Support Engineer | Redgate Software
Have you visited our Help Center?
Just letting you know that we've got a feature request for the ability to enable DriftOptionBlockDataLoss from the cmdlet and it's logged in our tracking system as SCA-68. Thanks again for this suggestion!
I do just want to clarify though: the DriftOptionBlockDataLoss option actually applies just to the drift correction script (not the update script).
Jessica Ramos | Product Support Engineer | Redgate Software
Have you visited our Help Center?