AbortOnWarningLevel Options in Sync-DatabaseSchema
Redshift
Posts: 31 Bronze 3
I recently had to delete some columns from a table that were no longer required.
The loss of data from those columns wasn't an issue as the columns were not in use.
Our powershell script failed with the following message:-
My question is, what do the various AbortOnWarningLevel Options mean in practice?
Could I have used a different option other than None when columns are being deleted?
The loss of data from those columns wasn't an issue as the columns were not in use.
Our powershell script failed with the following message:-
Sync-DatabaseSchema, SQL Change Automation 4.0.19274.11021, Copyright ¶¸ Red Gate Software Ltd 2014-2019 WARNING: (High) This deployment drops the column(s) [AntigenIdImported], [OldAntigenDescription], [ParentAntigenIdImported], [InterpretedTypeImported] and [BwAntigenTypeIdImported] from table [dbo].[reftblAntigens]. Data in these column(s), will be lost unless additional steps are taken to preserve it. Sync-DatabaseSchema : There are warnings that have caused the operation to abort: (High) This deployment drops the column(s) [AntigenIdImported], [OldAntigenDescription], [ParentAntigenIdImported], [InterpretedTypeImported] and [BwAntigenTypeIdImported] from table [dbo].[reftblAntigens]. Data in these column(s), will be lost unless additional steps are taken to preserve it. To force the operation to succeed regardless of warnings, set the 'AbortOnWarningLevel' parameter to None.I duly set the AbortOnWarningLevel option to None and the sync worked.
My question is, what do the various AbortOnWarningLevel Options mean in practice?
Could I have used a different option other than None when columns are being deleted?
Tagged:
Best Answer
-
DanC Posts: 637 Gold 5Hi @Redshift
Apologies, the following documentation should help provide the information you're after.
https://documentation.red-gate.com/sc/deploying-data-sources/deployment-warnings/full-list-of-deployment-warnings
Kind regards
Dan Calver | Redgate Software
Have you visited our Help Center?
Answers
So there's a number of different warning levels that prevent deployments from going through and will be aborted, based on the warning level set by yourself.
In this case, the warning for data loss was "High" and so rather than "None" I think you could have used at least "Medium"
The options are the following:
Use this parameter to set the minimum warning level that will cause the sync operation to abort.
Valid warning severity levels are:
- High
- Medium
- Low
- Information
- None (do not abort for any warnings)
The default setting is 'High'.
https://documentation.red-gate.com/sca/reference/powershell-cmdlets/sync-databaseschema
Kind regards
Dan Calver | Redgate Software
Have you visited our Help Center?
We hadn't set a warning level it was using the default.
My specific question related to what is caught by the different warning severity levels.
i.e. what is caught by high that isn't caught by medium or what is caught by medium that isn't caught by low.
Only when I know what the various severity warning levels catch can an informed decision be made as to the appropriate warning level to use.
Obviously 'none' is the sledgehammer approach and forces things through so it's a case of finding the right balance.
The documentation reference you've provided doesn't provide enough detail to make an informed decision.