如何在构建时创建“生成更新脚本” [英] how creating a 'Generate update script' at build time

查看:68
本文介绍了如何在构建时创建“生成更新脚本”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究SQL项目,我这是我将要完成的任务。现在确定我可以继续前进,因为我第一次触及devops。


1)我想将项目与主数据库(先前版本中数据库的相同副本)进行比较生成更改的dac或sql脚本。我怎么做?


如果我必须使用ms版本,那么somoene可以指导我吗? 和git或TFS等存储库实现上述目的。


我需要指导。


谢谢





我是新手和学生

解决方案

嗨boobyy,


感谢您在这里发帖。


AFAIK,您不必使用MSBuild,git或TFS,您可以使用架构比较工具。使用SQL-> 架构比较,设置源数据库和目标数据库,然后单击
比较,然后更新将变为可用 您可以单击它以应用数据库更改或单击生成脚本以获取T-SQL脚本,然后将脚本添加到包/发布中的数据库脚本部分SQL
将在下次发布后应用数据库更改。


有关更多详情,请查看以下主题:


https://stackoverflow.com/questions/18641573/how-to-add-postdeploy-script-during-schema-compare-generate-script


https:/ /msdn.microsoft.com/en-us/library/hh272690(v=vs.103).aspx


希望这会有所帮助。



I am working on the SQL Project and I here is the task that I will be working upon. Now sure how I can move on as I am touching the devops first time.

1) I want to compare the project with the master datbase (same copy of the datbase in previous release) and generate the dac or sql script of the changes. How I can do it?

Can somoene guide me if I have to use the ms build?  and repository such as git or TFS to achieve the above.

I need the guidance.

Thanks


i am a novice and a student

解决方案

Hi boobyy,

Thanks for posting here.

AFAIK, you do not have to use the MSBuild, git or TFS, you can use schema compare tool. Use SQL->Schema Compare, set the source database and target database, and click compare, then update will become available.  You can click on it to apply database changes or click Generate Script to get the T-SQL script, then add the script to in the Database scripts section in Package/Publish SQL will apply database changes after next publish.

For some more details, please check following threads:

https://stackoverflow.com/questions/18641573/how-to-add-postdeploy-script-during-schema-compare-generate-script

https://msdn.microsoft.com/en-us/library/hh272690(v=vs.103).aspx

Hope this helps.


这篇关于如何在构建时创建“生成更新脚本”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆