Microsoft Database Sync 设置与 TFS 2012 的持续集成 [英] Microsoft Database Sync set up Continuous Integration with TFS 2012

查看:18
本文介绍了Microsoft Database Sync 设置与 TFS 2012 的持续集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用正确版本的 Visual Studio 2012,我们可以拥有 数据库比较和同步

With the right version of Visual Studio 2012 we can have database compared and synced

我正在寻找将此同步过程集成到 TFS 构建中的方法,就像在代码的持续集成中一样;现在我需要它来存储数据库架构和数据.

I'm looking for way to integrate this synchronization process into a TFS build as in Continuous Integration for code; now I need that for database schema and data.

如果你知道怎么做,请分享.

Please share if you know how to do it.

推荐答案

在 VS 2010 和 2012 之间发生了一些变化.假设您使用的是 VS 2012(您发布的链接是 2010 tech),这意味着您正在使用 SSDT(SQL Server 数据工具).

Things changed a bit between VS 2010 and 2012. Assuming you're using VS 2012 (the link you posted was to 2010 tech), that means you're using SSDT (SQL Server Data Tools).

只要您的 SSDT 项目是您选择在 TFS Build 中构建的解决方案的一部分,它就会构建并输出一个 .dacpac 文件.然后,您可以通过调用 sqlpackage.exe here (直接来自 TFS Build,或者像我一样让 TFS Build 调用一个执行繁重工作的 powershell 脚本).sqlpackage.exe 将输入作为 .dacpac 文件和发布配置文件,其中包含部署所需的特定于环境的配置值.

So long as your SSDT project is part of the solution you've selected to build in TFS Build, it will build and output a .dacpac file. Then you can automate the deployment by calling the sqlpackage.exe here (either directly from the TFS Build, or like I do by having the TFS Build call a powershell script that does the heavy-lifting). sqlpackage.exe takes input as a .dacpac file and a publish profile with the environment-specific config values necessary for deployment.

更新

not in source 对象放在目标数据库上,例如.dacpac 中删除的表和列,使用 /p:DropObjectsNotInSource=true

To drop the not in source object(s) on target database, e.g. the removed tables and columns in .dacpac, use /p:DropObjectsNotInSource=true

这篇关于Microsoft Database Sync 设置与 TFS 2012 的持续集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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