跟踪数据库结构中的更改 [英] tracking changes made in database structure

查看:110
本文介绍了跟踪数据库结构中的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何能够跟踪我的数据库的所有更改?



我需要一种方法来确定我对数据库所做的更改,在另一个服务器上进行相同的更改。



例如,如果我在其中一个表中添加了一个新字段,我想知道是什么字段,

解决方案

面对这些问题时,人们经常遇到的步骤是:


  1. 以任何方式更改开发数据库。


  2. p>准备部署新版本的应用程序 - 实现生产数据库需要更新,同时保留数据。


  3. 转储生产和开发模式,手动更改模式创建脚本。轰隆头对墙壁。


  4. 实现更改脚本需要从更新开发数据库时开始写入,而不是willy-nilly添加和


  5. 查找用于对这些更改脚本进行版本化的命名方案,以便任何安装都可以从给定版本更新到较新版本。

    / li>
  6. 将数据库创建和更改脚本放在源代码管理中。


确保你不会每次都重复1-3次,而是4-6次,所以你不必每次都重复1-3次。


How would I be able to track all changes to my database?

I need a way to find out exactly what changes I made to the database so that I can make the same changes on another server.

For example, if I added a new field in one of the tables, I would like to know what field that was so that I could add that same field to another database.

解决方案

The steps people usually go through when facing these problems are:

  1. Change the development db in whatever way is needed at the time.

  2. Ready to deploy a new version of the application - realize the production database needs to be updated as well while retaining the data.

  3. Dump the production and development schema, manually diff the schema creation scripts. Bang head against wall. Write change scripts that updates the production database.

  4. Realize the change scripts needs to be written from the start when updating the development database instead of willy-nilly add and change stuff.

  5. Find a naming scheme for versioning those change scripts so any installation can be updated from a given version to a newer version.

  6. place the DB creation and change scripts in source control.

Make sure you're not repeating 1-3 every time, but get around to do 4-6 so you don't have to repeat 1-3 every time.

这篇关于跟踪数据库结构中的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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