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

本文是小编为大家收集整理的关于最佳数据库变更控制方法的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

作为数据库架构师,开发人员和顾问,可以回答许多问题.一,尽管最近被问到我仍然无法回答,但...

"什么是一种或某些最佳方法或技术来记录,有组织,却可以在单个开发器或多开发器环境中有效推出."

这可能涉及存储的过程和其他对象脚本,尤其是模式 - 从文档到新的物理更新脚本,再到推出,然后再循环.有一些应用程序可以实现这一目标,但是需要模式钩和开销.我想知道没有很多额外的第三方参与的技术.

推荐答案

我看到的最简单的方法是在没有外部工具的情况下完成的,如果可以的话,可以创建"架构补丁".模式补丁只是一个简单的T-SQL脚本.架构修补程序在脚本中给出了一个版本编号,并且该号码存储在数据库中的表中以接收更改.

数据库的任何新更改都涉及创建一个新的模式补丁程序,然后您可以按顺序运行,然后将其检测到当前数据库并在两者之间运行所有架构修补程序.之后,将使用该补丁程序存储以存储下一个运行的任何日期/时间更新架构版表.

这样的细节的好书被称为重构数据库.

如果您想使用外部工具,可以查看 Ruby的迁移或C#中的类似工具,称为 migrator.net.net .这些工具通过创建具有"正向"和"向后"迁移的C#类/Ruby类来起作用.这些工具具有更丰富的功能,因为他们知道如何向前和架构补丁中的向后进行.但是,正如您所说,您对外部工具不感兴趣,但我想我还是为其他读者补充.

其他推荐答案

我更喜欢这个系列: 2008/02/03/11746.aspx

其他推荐答案

在我的情况下,每次更改数据库时,我都会生成一个脚本,我将脚本命名为00001.SQL,N.SQL,并且我有一个表格,我执行的最后一个脚本.您还可以查看数据库文档

本文地址:https://www.itbaoku.cn/post/597602.html

问题描述

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.

推荐答案

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.

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.

其他推荐答案

I rather liked this series: http://odetocode.com/Blogs/scott/archive/2008/02/03/11746.aspx

其他推荐答案

In my case I have a script generate every time I change the database, I named the script like 00001.sql, n.sql and I have a table with de number of last script I have execute. You can also see Database Documentation