如何在 VWD 解决方案中更新生产数据库的架构而不覆盖数据?
我有一个数据驱动网站(SQL Express 自动附加 mdf 文件),该网站在 Visual Web Developer 2010 Express 中构建为本地站点,然后部署到生产服务器。该站点存储在本地并签入 SVN 进行版本控制。应用程序更新对本地副本进行(使用内置的开发 Web 服务器),然后使用复制网站功能复制到生产服务器。
我遇到的问题是,对数据库模式所做的任何更改都可以在本地进行测试,但是,似乎没有任何方法可以将这些更改复制到生产数据库而不覆盖整个文件(包括生产数据)。
我想我可以直接连接到生产数据库并手动进行必要的更改,但是,这会留下很大的出错空间,特别是在进行了大量更改的情况下。我在 VWD 中也没有看到任何方法来编写更改脚本。
所以我的问题是:在 VWD 2010 Express 中处理这些数据库架构更新的最佳方法是什么?
搜索 Stack Overflow 和 Google 一直没有结果,因此非常感谢任何帮助!
干杯,
乙脑
I have a data driven website (SQL Express auto-attached mdf file) that was built as a local site in Visual Web Developer 2010 Express, then deployed to a production server. The site is stored locally and checked into SVN for version control. Application updates are made to the local copy (using the built in development web server) then copied to the production server using the Copy Website function.
The problem I'm having is that any changes made to the database schema can be tested locally, however, there does not seem to be any way to copy these changes to the production database without overwriting the entire file including the production data.
I suppose I could connect to the production database directly and make the necessary changes by hand, however, this leaves a lot of room for error, especially in cases where a significant number of changes have been made. I do not see any way in VWD to script the changes either.
So my question is: What is the best way to handle these database schema updates in VWD 2010 Express?
Searching Stack Overflow and Google has been unfruitful, so any help is greatly appreciated!
Cheers,
JE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您指的是所谓的 SQL Express 用户实例。来自 这篇关于 SQL 的优秀文章 Express 用户实例,一个名为 SSEUtil 可用于针对本地用户实例执行命令。请注意,我说的是本地。
不幸的是,这并不能直接回答您有关如何在 VWD 2010 中最好地处理架构更新的问题。原因是没有任何方法可以做到这一点。用户实例是本地的(连接使用命名管道),您需要在生产环境中进行更新。使用 SSEUtil 比在服务器上安装 VWD 2010 或编写自己的代码来手动执行更新更好。
实际上,一旦数据库发布到生产环境中,更新脚本就是更新的唯一方式。显然,您很少可以备份开发数据库并恢复到生产环境。有专业级产品可以简化此操作处理但真正更新脚本是您开始的地方。
一个建议:如果可以的话,我会从用户实例化 SQL Express 迁移到至少一个常规 SQL Express 实例。
I believe you are referring to what are known as SQL Express User Instances. From this excellent article on SQL Express User Instances, a tool called SSEUtil can be used to execute commands against the local user instance. Note that I said local.
Unfortunately this isn't a direct answer to your question of how to best handle schema updates in VWD 2010. The reason for this is because there isn't any way to do this. User Instances are local (connections use named pipes) and you will need to do the updates within the production environment. Using SSEUtil is better than installing VWD 2010 on the server or writing your own code to do the updates manually.
Really once a database is released into production, update scripts are the only way things get updated. Obviously it's rare that you can do a backup of your dev database and restore to production. There are professional grade products that can simplify this process but really update scripts are where you start from.
One suggestion: I'd move away from User Instanced SQL Express to at least a regular SQL Express instance if you can.