[英]How to remove specific data loss warnings using DACPAC DeploymentPlanModifier?
I have a DeploymentPlanModifier implementation that, for simplicity, remove any AlterElementStep from the deployment plan that have AlterTableDropTableElementStatement script statements in it. 我有一个DeploymentPlanModifier实现,为简单起见,从其中包含AlterTableDropTableElementStateState脚本语句的部署计划中删除所有AlterElementStep 。
This makes sure that no ALTER TABLE ... DROP COLUMN ...
is generated in the deployment script. 这样可以确保在部署脚本中没有生成
ALTER TABLE ... DROP COLUMN ...
The deployment script and the deployment report, however, still gets generated with data loss checks (on the former) and warnings (on the latter) due to removed columns. 但是,由于删除了列,仍然会通过数据丢失检查(在前一种情况下)和警告(在后一种情况下)生成部署脚本和部署报告。
For the deployment script checks, I found that I could parse the script generated by DeploymentScriptSteps and remove those steps associated to the data loss check for the columns I did not drop. 对于部署脚本检查,我发现我可以解析DeploymentScriptSteps生成的脚本,并删除那些与我没有删除的列的数据丢失检查相关联的步骤。 However I'm still looking for a similar alternative for the deployment report.
但是,我仍在寻找部署报告的类似替代方案。
I do not want to disable data loss warnings/checks altogether. 我不想完全禁用数据丢失警告/检查。 I just want to manipulate the checks/warnings associated to the columns I am touching as part of my plan modifications.
作为计划修改的一部分,我只想操纵与要触摸的列相关的检查/警告。
Is there a better way to remove data loss checks and warnings from both artifacts without manually parsing the generated output? 有没有更好的方法可以从两个工件中删除数据丢失检查和警告,而无需手动解析生成的输出?
I've got a deployment contributor that does a similar thing (don't drop columns) and someone submitted a pull request where they did the same thing and th only way they could do it was to parse the generated output 我有一个部署贡献者,它做类似的事情(不要删除列),有人提交了一个拉取请求,他们在做同样的事情,而唯一的方法是解析生成的输出
This is how he did it: 这是他的做法:
https://agilesqlclub.codeplex.com/SourceControl/latest#SqlPackageFilter/Filter/DataLossCheckStep.cs https://agilesqlclub.codeplex.com/SourceControl/latest#SqlPackageFilter/Filter/DataLossCheckStep.cs
Ed 埃德
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.