最佳数据库变更控制方法 [英] Best Database Change Control Methodologies

查看:154
本文介绍了最佳数据库变更控制方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为数据库架构师,开发人员和顾问,有许多问题都可以回答。一个,虽然我最近被问到,仍然不能回答好,是...

As a database architect, developer, and consultant, there are many questions that can be answered. One, though I was asked recently and still can't answer good, is...


什么是一个, ,保持数据库更改记录,组织,并且能够在单开发人员或多开发人员环境中有效推出的最佳方法或技术。

"What is one of, or some of, the best methods or techniques to keep database changes documented, organized, and yet able to roll out effectively either in a single-developer or multi-developer environment."

这可能涉及存储过程和其他对象脚本,特别是模式 - 从文档,到新的物理更新脚本,然后全圆。有一些应用程序使这种情况发生,但需要模式钩子和开销。

This may involve stored procedures and other object scripts, but especially schemas - from documentation, to the new physical update scripts, to rollout, and then full-circle. There are applications to make this happen, but require schema hooks and overhead. I would rather like to know about techniques used without a lot of extra third-party involvement.

推荐答案

我见过的最简单的方法这样做没有外部工具的帮助是创建一个模式补丁,如果你愿意。模式补丁只是一个简单的t-sql脚本。

The easiest way I have seen this done without the aid of an external tool is to create a "schema patch" if you will. The schema patch is just a simple t-sql script. The schema patch is given a version number within the script and this number is stored in a table in the database to receive the changes.

对数据库的任何新的更改涉及创建一个新的模式补丁,然后您可以按顺序运行,然后它将检测数据库当前所在的版本,并在其间运行所有模式补丁。之后,模式版本表会随着补丁执行的日期/时间更新,以存储下次运行。

Any new changes to the database involve creating a new schema patch that you can then run in sequence which would then detect what version the database is currently on and run all schema patches in between. Afterwards the schema version table is updated with whatever date/time the patch was executed to store for the next run.

一本好书, a href =http://rads.stackoverflow.com/amzn/click/0321293533 =nofollow noreferrer>重构数据库。

A good book that goes into details like this is called Refactoring Databases.

如果您希望使用外部工具,您可以查看 Ruby的迁移项目或类似工具在C#中名为 Migrator.NET 。这些工具通过创建具有向前和向后迁移的c#classes / ruby​​类来工作。这些工具的功能更丰富,因为它们知道如何在模式修补程序中向前和向后。正如你所说,你对外部工具不感兴趣,但我想我会为其他读者添加。

If you wish to use an external tool you can look at Ruby's Migrations project or a similar tool in C# called Migrator.NET. These tools work by creating c# classes/ruby classes with an "Forward" and "Backward" migration. These tools are more feature rich because they know how to go forward as well as backwards in the schema patches. As you stated however, you are not interested in an external tool, but I thought I would add that for other readers anyways.

这篇关于最佳数据库变更控制方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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