如何管理具有分支机构的中型项目的数据库修订? [英] How do you manage database revisions on a medium sized project with branches?

查看:163
本文介绍了如何管理具有分支机构的中型项目的数据库修订?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在工作中,我们有4个人在一些不同的项目上合作。对于每个项目,我们每个都有我们工作的本地副本,然后开发,分期和实时部署,以及我们拥有的任何分支(我们使用subversion)。我们的数据库是MySQL。



所以我的问题是,什么是一个好的方法来管理数据库对每个部署的修改(对于开发人员他们的本地副本)。现在,每个更改都会转换为文本文件,该文本文件在名称中加上时间戳,并放入项目下的文件夹中。这是不正常的工作非常诚实..我需要一个解决方案,将有助于跟踪什么已应用于哪里。

解决方案

如果您的数据库很好地映射到一组数据访问对象,请考虑使用迁移。这个想法是将您的数据模型存储为应用程序代码,并具有通过每个数据库版本向前和向后移动的步骤。



我相信 Rails首先出现



Java具有至少一个项目



这里有一个 .NET迁移库



要更改版本,您运行一个简单的脚本,逐步执行所有的向上或向下版本,以使您你想要的版本它的优点是,您检查您的迁移到与您的应用程序代码相同的源存储库 - 它都在一个地方。



也许其他人可以建议其他迁移库。 / p>

干杯。



编辑:另见 http://stackoverflow.com/questions/313/net-migrations-engine .NET数据库迁移工具汇总(从上面的帖子)。


At work we have 4 people working together on a few different projects. For each project we each have a local copy we work on and then there is a development, staging, and live deployment, along with any branches we have (we use subversion). Our database is MySQL.

So my question is, what is a good way to manage which revisions to the database have been made to each deployment (and for the developers their local copies). Right now each change goes into a text file that is timestamped in the name and put into a folder under the project. This isn't working very well to be honest.. I need a solution that will help keep track of what has been applied where.

解决方案

If your database maps nicely to a set of data access objects, consider using 'migrations'. The idea is to store your data model as application code with steps for moving forward and backward through each database version.

I believe Rails did it first.

Java has at least one project.

And here's a .NET migration library.

To change versions, you run a simple script that steps through all of the up or down versions to get you to the version you want. The beauty of it is, you check your migrations into the same source repository as your app code - it's all in one place.

Maybe others can suggest other migration libraries.

Cheers.

Edit: See also http://stackoverflow.com/questions/313/net-migrations-engine and .NET database migration tool roundup (from above post).

这篇关于如何管理具有分支机构的中型项目的数据库修订?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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