数据库结构和源代码控制 - 最佳实践 [英] Database structure and source control - best practice

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

问题描述

背景



我来自一家公司的几年工作,所有数据库对象都存储在源代码控制中,每个对象。我们有一个列表,列出了添加新项目时所维护的所有对象(允许我们使脚本按顺序运行并处理依赖关系)和一个VB脚本,该脚本运行以创建一个大脚本以针对数据库运行。



所有表格都是如果不存在则创建和所有SP等都已删除并重新创建。



到目前为止,我现在工作在一个数据库是主数据库,没有数据库对象的源控件的地方,但我们使用redgate的工具更新我们的生产数据库(SQL比较),这是非常方便,



如何处理您的数据库对象?我喜欢让它们在源代码控制下(因为我们使用GIT,我希望能够处理脚本中的合并冲突,而不是DB),但我会被迫按过去使用SQL的方便性比较更新数据库。



我真的不想让我们在GIT中更新脚本,然后使用SQL比较更新生产数据库我们的DEV DB,因为我宁愿有一个版本的真相,但我不想真的想重新编写一个自定义的软件捆绑所有的脚本在一起。



我认为visual studio数据库版本可能会做类似的事情,但我不知道我们是否会有预算。



我确定这被要求死亡,但我找不到任何似乎有我想要的答案。
与此类似,但不完全相同:








开始一个赏金,因为我有兴趣拉票几个意见 - 这里的答案是声音,但我觉得应该有一个更容易的方法。 / h2>

感谢所有的伟大的答案 - 所有有他们的优点,所以我要取最高的投票,但欢呼所有的输入。

解决方案

我们使用Visual Studio数据库版本(DBPro)在源代码控制下使用我们所有的数据库对象。它是一个很好的工具,版本控制我们的模式,做构建,验证,允许代码分析,模式比较,部署,数据比较,重构等。它是从根本设计的DB管理和版本控制系统。非常推荐。



这是DBPro的首席架构师的博客网站: http://blogs.msdn.com/gertd/archive/ 2008/11/25 / visual-studio-team-system-2008-database-edition-gdr-rtm.aspx


Background

I came from several years working in a company where all the database objects were stored in source control, one file per object. We had a list of all the objects that was maintained when new items were added (to allow us to have scripts run in order and handle dependencies) and a VB script that ran to create one big script for running against the database.

All the tables were 'create if not exists' and all the SP's etc. were drop and recreate.

Up to the present and I am now working in a place where the database is the master and there is no source control for DB objects, but we do use redgate's tools for updating our production database (SQL compare), which is very handy, and requires little work.

Question

How do you handle your DB objects? I like to have them under source control (and, as we're using GIT, I'd like to be able to handle merge conflicts in the scripts, rather than the DB), but I'm going to be pressed to get past the ease of using SQL compare to update the database.

I don't really want to have us updating scripts in GIT and then using SQL compare to update the production database from our DEV DB, as I'd rather have 'one version of the truth', but I don't really want to get into re-writing a custom bit of software to bundle the whole lot of scripts together.

I think that visual studio database edition may do something similar to this, but I'm not sure if we will have the budget for it.

I'm sure that this has been asked to death, but I can't find anything that seems to quite have the answer I'm looking for. Similar to this, but not quite the same:

What are the best practices for database scripts under code control


Started a bounty, as I'm interested in canvassing for a few more opinions - the answers here are sound, but I feel that there should really be an easier way.

Thanks for all the great answers - all have their merits, so I'm going to take the highest vote, but cheers for all the input.

解决方案

We have all our database objects under source control using Visual Studio Database Edition (DBPro). It is a wonderful tool that version controls our schema, does builds, validations, allows code analysis, schema comparisons, deployments, data comparisons, refactoring etc. It was designed from the ground up to be a DB management and version control system. Highly recommended.

This is the blog site of the lead architect for DBPro: http://blogs.msdn.com/gertd/archive/2008/11/25/visual-studio-team-system-2008-database-edition-gdr-rtm.aspx

这篇关于数据库结构和源代码控制 - 最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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