您如何跟踪源代码管理中的数据库更改? [英] How do you track database changes in source control?

查看:143
本文介绍了您如何跟踪源代码管理中的数据库更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在大多数项目中使用SQL Server 2000/2005和Vault或SVN.在任何一个源代码管理系统中,我都没有找到一个不错的解决方案来捕获数据库模式/过程更改.

We use SQL Server 2000/2005 and Vault or SVN on most of our projects. I haven't found a decent solution for capturing database schema/proc changes in either source control system.

我们当前的解决方案非常麻烦且难以实施(将您更改的对象写成脚本并将其提交到数据库中).

Our current solution is quite cumbersome and difficult to enforce (script out the object you change and commit it to the database).

关于如何通过一些自定义开发来解决此问题,我们有很多想法,但我宁愿安装现有工具(付费工具也可以).

We have a lot of ideas of how to tackle this problem with some custom development, but I'd rather install an existing tool (paid tools are fine).

因此:您如何跟踪数据库代码更改?你有推荐的工具吗?

So: how do you track your database code changes? Do you have any recommended tools?

感谢所有建议.由于时间限制,我宁愿不在这里投稿.而且大多数建议都存在缺陷,要求开发人员遵循某些程序.

Thanks for all the suggestions. Due to time constraints, I'd rather not roll my own here. And most of the suggestions have the flaw that they require the dev to follow some procedure.

相反,理想的解决方案是监视SQL数据库中的更改并将任何检测到的更改提交给SCM.例如,如果SQL Server有一个可以记录进行更改的用户的DML更改的附件,然后将该对象的脚本提交给SCM,我会很高兴.

Instead, an ideal solution would monitor the SQL Database for changes and commit any detected changes to SCM. For example, if SQL Server had an add-on that could record any DML change with the user that made the change, then commit the script of that object to SCM, I'd be thrilled.

我们在内部讨论了两个系统: 1.在SQL 2005中,使用对象权限可以限制您更改对象,直到您执行签出"为止.然后,签入过程会将其脚本化为SCM. 2.运行计划的作业以检测任何更改并将其(匿名)提交给SCM.

We talked internally about two systems: 1. In SQL 2005, use object permissions to restrict you from altering an object until you did a "checkout". Then, the checkin procedure would script it into the SCM. 2. Run a scheduled job to detect any changes and commit them (anonymously) to SCM.

如果我可以跳过用户操作部分并让系统自动处理所有这一切,那就太好了.

It'd be nice if I could skip the user-action part and have the system handle all this automatically.

推荐答案

使用Visual Studio数据库版本编写数据库脚本.就像魅力一样工作,您可以使用任何Source控制系统,如果它具有VS插件,那当然是最好的.该工具还具有许多其他有用的功能.在这篇很棒的博客文章中查看它们

Use Visual studio database edition to script out your database. Works like a charm and you can use any Source control system, of course best if it has VS plugins. This tool has also a number of other useful features. Check them out here in this great blog post

http://www.vitalygorn.com/blog/post/2008/01/Handling-Database-easily-with-Visual-Studio-2008.aspx

或查看MSDN的官方文档

or check out MSDN for the official documentation

这篇关于您如何跟踪源代码管理中的数据库更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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