简体   繁体   English

如何使用DACPAC DeploymentPlanModifier删除特定的数据丢失警告?

[英]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.

相关问题 如何在 DacPac 中包含数据 - How to include data in a DacPac ssdt dacpac:如何防止 dacpac 在删除包含数据的表中的列时产生错误 - ssdt dacpac: how to prevent dacpac to generate the error when dropping columns in a table with data 如何使用Visual Studio中的DACPAC部署具有不同架构的对象 - How to deploy objects with different schema using DACPAC from Visual Studio 如何使用 SQLPackage.exe 将数据库与 Dacpac 进行比较 - How To Compare Database To Dacpac using SQLPackage.exe 如何穿越dacpac - How to traverse a dacpac SQL Server数据工具:加载自定义DeploymentPlanModifier时出错:无法加载具有id的必需参与者 - SQL Server Data Tools: Error loading custom DeploymentPlanModifier: Required contributor with id could not be loaded 如何使用VSTS(Visual Studio团队服务)发布管理将DACPAC文件部署到sql azure - How to deploy DACPAC file to sql azure using VSTS (Visual studio team services) Release Management 如何在SQL Server中使用DACPAC将可空列更新为不可为空 - How can I update a nullable column to be not nullable, in SQL Server using DACPAC 如何在 dacpac 中打包部署贡献者? - How to package a deployment contributor in a dacpac? 如何避免 CI 中的 .dacpac 项目检查? - How to avoid .dacpac project checks in CI?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM