SQL Server 版本控制?

发布于 2024-08-13 19:53:18 字数 471 浏览 3 评论 0原文

我的开发小组使用 Visual Source Safe 进行版本控制;这一选择最初是由于成本及其与 Visual Studio 的紧密集成而做出的。

随着我们的存储库的增长,Source Safe 确实开始显示出其局限性,我们正在考虑转向另一个解决方案。可供讨论的有 Team Foundation Server、Subversion、Git 和 Mercurial。

我们主要是一家数据商店,因此对我们来说另一个主要因素是能够轻松地对 SQL Server 2005/2008 项目进行版本控制。这是使用 Source Safe 以及 Team Foundation Server 的好处之一 - 与 Microsoft SQL Server Management Studio 的集成。

我想知道是否有人有过使用 Subversion、Git 或 Mercurial 对 SQL Server 进行版本控制的经验,并且可以为每个系统提供一些可靠的优点/缺点,以及如何实现它们。

My development group uses Visual Source Safe for version control; this choice was originally made due to cost and its tight integration with Visual Studio.

As our repository has grown Source Safe has really started to show its limitations and we are considering moving to another solution. Up for discussion are Team Foundation Server, Subversion, Git, and Mercurial.

We are largely a data shop, so another major factor for us is being able to easily version SQL Server 2005/2008 projects. This is one of the benefits of using Source Safe, and also of Team Foundation Server - the integration with Microsoft SQL Server Management Studio.

I'm wondering if anyone has had experience versioning SQL Server with Subversion, Git, or Mercurial and can provide some solid pros/cons for each of these systems, as well as how you went about implementing them.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

南冥有猫 2024-08-20 19:53:18

我诚实的回答是,如果可以避免的话,不要与数据库工具和 SCM 进行任何集成。尽可能使用文件系统。这是另一层集成,这将是一个痛苦的过程。小型独立工具比庞然大物更好。

我们按以下方式一起使用 Subversion 和 SQL 2005:

  • 我们仅使用 TortoiseSVN。根本没有 VS/SSMS 集成。
  • 我们的原则是“一切自动化”,因此我们从不依赖 GUI 工具来完成工作。
  • 我们将所有脚本与代码一起保存在 SVN 中。代码、架构和脚本一起进行版本控制。
  • 架构更改按应用顺序编号,即 000-create-table-users.sql。我们记下每个环境中部署的最大脚本数量。每个脚本都会执行到下一个数据库 r 编号的迁移。当我们部署时,我们检查源并运行从最后版本号到最高版本号的所有脚本。
  • 任何非模式脚本(存储过程/视图)都是幂等的(可以执行任意多次并获得相同的结果)。它们是通过我们编写的 nant 插件应用的。每次我们部署时都会更换它们。别忘了刷新你的看法!
  • 无论如何,当我们使用 NHibernate 时,我们会尽可能避免使用任何脚本,因此脚本版本控制的问题会更少。

从这个结构中,我们可以在任何时间点在任何机器上重新创建环境和数据库,这很重要。

然而,我们不将其用于单元测试 - 我们依靠 NHibernate 模式生成在 SQLite 数据库之上执行此操作。

我们遇到的唯一负面问题是确保开发人员遵守该流程。牧猫是一个非常恰当的描述。

My honest answer is don't do any integration with your database tooling and SCM if you can avoid it. Use the filesystem where possible. It's another layer of integration which is going to be a pain. Small separate tools are better than a behemoth.

We use Subversion and SQL 2005 together in the following manor:

  • We use TortoiseSVN only. No VS/SSMS integration at all.
  • We have a principle of "automate everything", so we never rely on GUI tools to do work.
  • We keep all scripts inside SVN along with the code. The code, schema and scripts are versioned together.
  • Schema changes are numbered in order of application i.e. 000-create-table-users.sql. We write down the maximum script number deployed in each environment. Each script performs a migration to the next database r number. When we deploy, we check out the source and run all scripts from the last version number to the highest number.
  • Any non-schema scripts (sprocs/views) are idempotent (can be executed any number of times with the same result). They are applied via a nant plugin we wrote. These are replaced every time we deploy. Don't forget to refresh your views!
  • We avoid any scripts where possible anyway as we use NHibernate so there are less problems with script versioning anyway.

From this structure, we can re-create the environment and database at any point in time on any machine which is important.

We do NOT use it for unit testing however - we rely on the NHibernate schema generation to do this on top of an SQLite database.

The only negative point we've encountered has been making sure that developers adhere to the process. Herding cats is a very appropriate description.

も让我眼熟你 2024-08-20 19:53:18

Visual Studio Team System 2008 数据库版(代号“DataDude”)正是您所需要的。

它允许您以令人惊叹的方式对数据库对象进行版本控制。 (例如,将客户站点升级到特定版本,或回滚到以前的版本而不破坏任何数据)。

查看 Gert Drapers 博客中的功能,从 这篇文章

或者,如果您更喜欢播客,请收听 Chris Sells in show 494 的 DotNetRocks 。

我不知道在使用 DataDude 时您是否仅限于使用 TFS 进行源代码控制,但它是 Visual Studio 家族中不值得“低估”的成员。

Visual Studio Team System 2008 Database Edition (codename "DataDude") is what you need.

It allows you to version your database objects in ways that will blow your mind. (eg upgrade a customer site to a specific version, or rollback to a previous version without destroying any data).

Check out the features at Gert Drapers' blog, starting with this post.

Or if you prefer a podcast, listen to DotNetRocks with Chris Sells in show 494.

I don't know whether you're limited to TFS for source control, when using DataDude -- but it is the undeservedly "underhyped" member of the Visual Studio family.

无所的.畏惧 2024-08-20 19:53:18

这可能对您来说是一个有用的工具:
http://www.liquibase.org/

它的设计目的是为了在任何系统中轻松进行版本控制,并以合理的方式管理您的升级脚本。

This might be a useful tool for you:
http://www.liquibase.org/

It's designed so that it's easy to version control in any system, and manages your upgrade scripts in a sane way.

心舞飞扬 2024-08-20 19:53:18

恕我直言,Git 和 Mercurial 是唯一您应该考虑的,其他 2 个都太过时了。现代 SCM 应该像 git 一样对待分支。

有关 git 与 Mercurial 的比较,请参阅:
http://rg03.wordpress。 com/2009/04/07/mercurial-vs-git/http://www.russellbeattie.com/blog/distributed-revision-control-systems-git-vs-mercurial-vs-svn

虽然我过去没有 SSMS SCM 集成的经验,但据我所知,提到的两个系统(除了 TFS)都没有经验。我不会称其为缺点 - 例如 git GUI 是一个非常方便的工具,您会发现它比这样的集成更令人愉快。至少这是我从 SVN(使用 Ankh 进行 VS 集成)迁移到 Git(根本没有集成)时的情况...

Git and Mercurial are the only ones you should consider IMHO, the other 2 are too old-fashioned. Modern SCMs should treat branches like git does.

For git vs. mercurial comparisons see:
http://rg03.wordpress.com/2009/04/07/mercurial-vs-git/, http://www.russellbeattie.com/blog/distributed-revision-control-systems-git-vs-mercurial-vs-svn.

I have no past experience with SSMS SCM integration though, but AFAIK neither of the systems mentioned (except from TFS) have one. I wouldn't call it a disadvantage tho - git GUI for example is a pretty handy tool, which you'll find more enjoyable than such an integration. This is at least my case when moving from SVN (with VS integration using Ankh) to Git (with no integration at all)...

伪装你 2024-08-20 19:53:18

如果您认为 DVCS 是最佳选择,Mercurial 已将 VS 与 VisualHG 集成。我们将其用于我们商店的 C++/C# 项目,并且效果很好。 (OTOH,我从未使用过任何“完整”集成,因此我很高兴使用资源管理器扩展和/或命令行来进行详细的 VC 工作。)

Mercurial has VS integration with VisualHG, if you think DVCS is the way to go. We use that for C++/C# projects in our shop, and it works well enough. (OTOH, I've never used any "full" integration, so I'm happy to work with the explorer extension and/or command-line for detailed VC work.)

与君绝 2024-08-20 19:53:18

我们现在已向 SQL 源代码控制添加了 VSS 支持,它与 SSMS 集成,为数据库开发提供完全集成的源代码控制。要尝试此操作,请访问:
http://www.red-gate.com/MessageBoard/viewtopic。 php?t=12265

We've now added VSS support to SQL Source Control, which integrates with SSMS to provide fully integrated source control for database development. To try this out, please visit:
http://www.red-gate.com/MessageBoard/viewtopic.php?t=12265

江湖正好 2024-08-20 19:53:18

TFS 缺少 VSS 的一些功能,特别是关键字扩展。如果您没有在源文件中嵌入修订关键字信息,那么就不必担心。

TFS is missing a few features of VSS, notably keyword expansion. If you don't embed revision keyword info within your source files, then it should not be a concern.

苏佲洛 2024-08-20 19:53:18

可能有很多替代方案 - SQL Server Management Studio (SSMS) 支持与任何 Microsoft 源代码控制接口集成 MSSCCI 提供商。因此,您可以将搜索范围扩大到具有 MSSCCI 兼容提供商的源代码控制系统。

在 SSMS 中,查看工具 ->选项->源代码控制可查看您的系统上安装了哪些提供程序插件。

例如,Team Foundation Server 与 SQL Management Studio 的集成是由 TFS MSSCCI 提供程序提供的。我认为有一个 CVS/Subversion 的提供商(“Aigenta Unified SCC”)等等。

至于优缺点列表,我认为只要有兼容的提供商,您就可以向更广泛的受众开放这个问题。我的主要经验是使用 VSS、TFS 和 Subversion。这实际上取决于您的团队和环境。您能详细说明一下您的环境吗?

例如,

  • 您对建立 CI(持续集成)感兴趣吗?
  • 自动构建/自动版本控制?
  • 支持多种环境?
  • 配置管理?
  • 你们有多少团队规模?可能有很多合并/分支等?
  • 您是否已经建立了错误跟踪系统(作为 TFS 推出的一部分,您获得了工作项/错误跟踪)?

There are potentially quite a number of alternatives - SQL Server Management Studio (SSMS) supports integration with any Microsoft Source Code Control Interface MSSCCI Provider. So you can broaden the search to source control systems that feature an MSSCCI compatible provider.

In SSMS, Check out Tools -> Options -> Source Control to see what provider plug-ins are installed on your system.

For example, Team Foundation Server's integration with SQL Management Studio is courtesy of the TFS MSSCCI Provider. I think there's a provider for CVS/Subversion ("Aigenta Unified SCC") and so on.

As to a pros/cons list, I think provided there's a compatible provider, you can open the question up to a wider audience. My main experience is with VSS, TFS and Subversion. It really comes down to your team, and environment. Can you elaborate more on your environment?

E.g.

  • would you be interested in establishing CI (continuous integration)?
  • automated builds/automated versioning?
  • support for multiple environments?
  • configuration management?
  • what team size do you have? likely to have lots of merges/branching etc?
  • do you have a bug tracking system in place already (you get work items/bug tracking as part of a TFS roll out)?
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文