在Azure Devops管道中进行SQL部署时面临错误

Am在azure devops的发布管道中使用sql DACPAC类型的部署,但出现以下错误。我对SQL一无所知,有什么建议吗?

Publishing to database 'database_name' on server 'Server_name'. 
Initializing deployment (Start) 
*** The column [dbo].[xxxx].[yyyy] is being dropped,data loss could 
occur. 
Initializing deployment (Complete) 
Analyzing deployment plan (Start) 
*** If this deployment is executed,changes to [dbo].[xxx2] might 
introduce run-time errors in [dbo].[yyyy2]. 
Analyzing deployment plan (Complete) 
Updating database (Start) 
An error occurred while the batch was being executed. 
Updating database (Failed)
qq_zjy3 回答:在Azure Devops管道中进行SQL部署时面临错误

同意迈克尔的任命。

  

[***]列被删除,可能会丢失数据。

  

如果执行此部署,可能会更改[]   []中的运行时错误。

所有这些都是由于违反安全性造成的。我假设您对数据库做了一些更改,这些更改无法确定它是否会破坏目标数据库上的任何内容。现在,由于服务器无法确定更改是否安全,因此它将阻止部署。


  • 第一个解决方案设置为/p:BlockOnPossibleDataLoss=false

BlockOnPossibleDataLoss的默认值为true,这意味着如果检测到可能的数据丢失,请停止部署。并且false SqlPackage.exe 忽略它们。

因此,请执行任务,然后定位至并将以上参数输入附加SqlPackage.exe参数

enter image description here


    输入
  • 第二个解决方案 /p:TreatVerificationErrorsAsWarnings=true

注意: 如果第一个解决方案不适合您,则应使用第二个解决方案。

设置TreatVerificationErrorsAsWarnings=true意味着将验证错误视为警告,以获取完整的问题列表,并且可以绕过允许在第一个错误发生时停止发布操作的限制。


查看此doc以获得更多的发布操作。

本文链接:https://www.f2er.com/3167889.html

大家都在问