在多个环境中保持开发数据库同步 [英] Keeping development databases in multiple environments in sync

查看:339
本文介绍了在多个环境中保持开发数据库同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2008内建的网路应用程式开发早期。我有一台台式电脑(大多数工作都完成)和一台笔记本电脑(偶尔可移植),我使用AnkhSVN保持项目代码同步。什么是保持我的开发数据库(SQL Server Express)同步的最好方法?



我在SVN中有一个VS数据库项目,包含我重新生成的脚本当模式改变时。最初的想法是在任何事情发生变化时重新创建数据库,但它很快就变成了一种痛苦。此外,我会丢​​失所有的输入示例行,以确保正确显示数据。



我正在考虑将.MDF和.LDF文件放在源控制,但我怀疑SQL Server Express将优雅地处理它,如果我做一个SVN更新和文件被嘲笑出来,它替换为较新的副本。将几个大的二进制文件粘贴到源代码控制中似乎不是一个优雅的解决方案,即使它只是一个一次性的开发数据库。任何建议?

解决方案

除了数据库CREATE脚本,为什么不保留默认数据或示例数据脚本好?



这是我们对一个应用程序的增量版本所采用的一种方法,我们已经维护了2年以上,它的工作原理非常好。拥有默认数据脚本还允许您的QA测试人员使用您还有的数据重新创建错误。



您可能还需要查看一个问题我发布了一段时间之前:



自动生成SQL更改脚本的最佳工具


I'm early in development on a web application built in VS2008. I have both a desktop PC (where most of the work gets done) and a laptop (for occasional portability) on which I use AnkhSVN to keep the project code synced. What's the best way to keep my development database (SQL Server Express) synced up as well?

I have a VS database project in SVN containing create scripts which I re-generate when the schema changes. The original idea was to recreate the DB whenever something changed, but it's quickly becoming a pain. Also, I'd lose all the sample rows I entered to make sure data is being displayed properly.

I'm considering putting the .MDF and .LDF files under source control, but I doubt SQL Server Express will handle it gracefully if I do an SVN Update and the files get yanked out from under it, replaced with newer copies. Sticking a couple big binary files into source control doesn't seem like an elegant solution either, even if it is just a throwaway development database. Any suggestions?

解决方案

In addition to your database CREATE script, why don't you maintain a default data or sample data script as well?

This is an approach that we've taken for incremental versions of an application we have been maintaining for more than 2 years now, and it works very well. Having a default data script also allows your QA testers to be able to recreate bugs using the data that you also have?

You might also want to take a look at a question I posted some time ago:

Best tool for auto-generating SQL change scripts

这篇关于在多个环境中保持开发数据库同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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