您如何处理多个开发人员和数据库更改?

发布于 2024-10-27 23:36:22 字数 108 浏览 4 评论 0原文

我想知道你们如何处理 2 个或更多开发人员小组中的开发数据库更改?您是否拥有每个人都可以访问的全局数据库,也许是本地副本并手动应用脚本更改?很高兴看到您注意到的每种方法的优缺点以及团队中的开发人员数量。

I would like to know how you guys deal with development database changes in groups of 2 or more devs? Do you have a global db everyone access, maybe a local copy and manually apply script changes? It would be nice to see pros and cons that you've noticed for each approach and the number of devs in your team.

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

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

发布评论

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

评论(3

分開簡單 2024-11-03 23:36:22

从 Martin Fowler 的“进化数据库设计”开始。这很好地总结了

还有其他关于数据库开发的问题也可能有用,例如 RedGate SQL 源代码管理适合我吗?

Start with "Evolutionary Database Design" by Martin Fowler. This sums it up nicely

There are have been other questions about DB development that may be useful too, for example Is RedGate SQL Source Control for me?

峩卟喜欢 2024-11-03 23:36:22

我们的方法是每个人都有自己的数据库,如果需要,可以通过使用基础数据创建脚本来创建完整的数据库。为此所需的所有脚本都在源代码管理中。

所有脚本都是CREATE 脚本,它们反映了数据库模式的当前状态。升级位于单独的 SQL 文件中,可以将现有数据库从特定版本升级到较新版本(按顺序运行)。应用所有更新后,架构必须与运行安装脚本所获得的架构相同。

我们有一些工具可以做到这一点(我们使用 SQL Server 和 .NET):

  • 脚本编写是使用一个工具完成的,该工具也应用标准格式,以便可以使用文本差异工具(以及 SCM)很好地跟踪更改
  • 运行时模块需要负责比较现有数据库对象,根据需要运行更新,自动应用“非破坏性”更改,然后再次检查数据库对象以确保在提交更改之前正确迁移

该工具集作为开源项目提供(在 LGPL 下许可) ),它称为 bsn ModuleStore(请注意,它仅限于 SQL Server 2005 /2008/Azure 以及运行时部分的 .NET)。

Our approach is that everyone has their own DB, the complete DB can be created from create scripts with base data if required. All the scripts required for this are in source control.

All scripts are CREATE scripts and they reflect the current state of the database schema. Upgrades are in separate SQL files which can upgrade existing DBs from a specific version to a newer one (run sequentially). After all the updates have been applied, the schema must be identical to what you would get from running the setup scripts.

We have some tools to do this (we use SQL Server and .NET):

  • Scripting is done with a tool which also applies a standard formatting so that the changes are well traceable with text diff tools (and by the SCM)
  • A runtime module takes care of comparing the existing DB objects, run updates if required, automatically apply "non-destructive" changes, then check the DB objects again to ensure a correct migration before committing the changes

The toolset is available as open-source project (licensed under LGPL), it's called the bsn ModuleStore (note that it is limited to SQL Server 2005/2008/Azure and to .NET for the runtime part).

昨迟人 2024-11-03 23:36:22

我们使用代号为“Data Dude”的东西(TFS 和 Visual Studio 中的数据库功能)来处理这个问题。当您“获取最新”并引入依赖于架构更改的代码时,您还引入了修订后的架构、存储过程等。您右键单击数据库项目并部署;使您的本地架构和 sp 同步,但不会覆盖您的数据。编写脚本以将旧模式转换为新模式的工作由 Visual Studio 承担,而不是由您或您的 DBA 负责。我们还为省份列表等内容提供“填充”脚本,并为您部署运行它们。

比旧的方式好多了,旧的方式总是在高压力的时候崩溃,人们检查代码然后回家,没有人知道要添加哪些列才能使代码工作等。

We use what was code named "Data Dude" - the database features in TFS and Visual Studio - to deal with this. When you "get latest" and bring in code that relies on a schema change, you also bring in the revised schemas, stored procedures etc. You rigght-click the database project and Deploy; that gets your local schema and sp in sync but doesn't overwrite your data. The job of working out the script to get you from your old schema to the new one falls to Visual Studio, not to you or your DBA. We also have "populate" scripts for things like lists of provinces and a deploy runs them for you.

So much better than the old way which always fell apart at high stress times, with people checking in code then going home and nobody knowing what columns to add to make the code work etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文