6

我想在 CVS 下拥有所有 DB DDL 代码

我们正在为我们的 .NET 代码使用 Subversion,但所有数据库代码仍然没有版本化。

我们所知道的是数据库逻辑的重要性。我用谷歌搜索过,但我发现只有少数(昂贵的工具)。我相信存在其他(更便宜的)解决方案。

您建议遵循什么方法?什么工具最合适?

SQL Server 2005、VS 2008 TS、TSVN

更新 我们的编码场景是开发人员无法直接访问 PROD DB。它仅由脚本更改(因此这不是问题)

我最感兴趣的是所有开发人员都可以完全访问的 DEV 环境。
因此,开发人员会覆盖之前由另一个人更改的 USP。
我希望有可能恢复丢失的版本/比较 USP 修订等。

UPDATE-2
为了创建部署脚本,我们使用 Red-Gate SQL Compare。
完美运行 - 所以部署脚本不是一个案例。

4

9 回答 9

4

如果您还没有阅读过,Martin Fowler 的文章Evolutionary Database Design是一个很好的起点。

这篇文章很难总结,但它描述了他的团队如何在快速变化的开发过程中处理数据库版本控制。他们创建了自己的工具来简化事情:将用户带到当前主人的脚本,复制任何版本的模式,以便用户可以调试彼此的工作副本,等等。

对于可靠的低技术解决方案,我发现在源代码管理中保留两种 DDL 脚本很有帮助:

  • 可以从头开始创建数据库对象的主版本。
  • 每次开发迭代的“版本升级”脚本。

它们在一定程度上是多余的,但非常有用(尤其是在部署方面)。

于 2010-01-12T15:03:47.807 回答
2

如果您还没有看过 Visual Studio Database Edition GDR(又名“Data Dude”),那么您绝对应该下载并尝试一下:

http://www.microsoft.com/downloads/details.aspx?FamilyID=bb3ad767-5f69-4db9-b1c9-8f55759846ed&displaylang=en

除其他外,GDR 将通过让每个开发人员轻松维护自己的数据库本地副本、版本脚本、创建部署脚本以将数据库模式移动到新版本,甚至支持数据库回滚来促进团队开发。

如果您使用的是团队系统开发者版,它是免费的。一探究竟。

于 2010-01-12T15:21:47.610 回答
1

We use Subversion for all our database code as well. Since nothing is allowed to go to Prod unless it is in a script, there seems to be no porblem with getting people to put all the scripts into subversion. We tend to write alter table scripts to change tables with existing data and then recreate the whole table structure in case we need to create a new database from scratch (we often have the same database structure on multiple servers as some of our clients are very large and do not want their data accidentally available to the competition and so pay for separate servers and therefore may need to create the whole database again with no data.) For objects that don't directly store data we drop the orginal object and recreate it with a create statement. Each project has it's own home inthe repository and each database does too, so the script may be in more than one place to facilitate deployment.

But the real key is that no one can load to Prod without a script. We don't give our devs direct rights to prod, so they have no problem doing things in scripts as opposed to using SSMS.

于 2010-01-12T15:30:50.540 回答
1

我编写了SMOscript,它为数据库中的每个对象生成一个 CREATE 脚本。

使用此工具生成 CVS 覆盖的目录,并更新您的存储库。

于 2010-01-13T10:04:15.783 回答
1

如果您使用的是 Visual Studio Team Suite 或 Visual Studio Developer Edition,您有权获得 Visual Studio Database Professional 的副本。这旨在完全按照您的描述进行,等等。我们用它来管理我们的数据库模式(代码)。

兰迪

于 2010-01-12T15:18:31.833 回答
1

您应该使用 Management Studio (SSMS) 并将 .sql 置于源代码控制之下,可能是文件夹下的单独架构对象。希望这可以帮助

于 2010-09-28T14:02:32.817 回答
1

最后我发现这个工具和方法非常有用并且很容易介绍
(至少在开始时 - 没有版本控制解决方案的地方):

http://www.codeproject.com/KB/database/SQLScripter.aspx

您可以开箱即用。
对于最终解决方案,我倾向于 GDR。

于 2010-01-14T12:40:09.257 回答
0

看看Wizardby是否符合您的需求。

于 2010-01-13T09:54:32.483 回答