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

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

问题描述

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

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 good book that goes into details like this is called Refactoring Databases.

如果您希望使用外部工具,你可以看看 Ruby的迁移项目或在C#中一个类似的工具称为 Migrator.NET 。这些工具通过与前进和后退移民创建的C#类/ 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天全站免登陆