软件补丁/更新/升级的数据库变更管理

发布于 2024-07-13 09:54:06 字数 630 浏览 6 评论 0原文

几周以来,我一直在尝试找到更详细的解释,并举例说明如何管理软件补丁上的数据库更改。

情况:

  • 我将 wpf 应用程序版本部署到 用户。 应用程序使用 MSSQL 数据文件 存储应用程序的数据(使用客户端配置文件和 SqlServer Compact 3.5 先决条件进行部署)
  • 在进一步开发数据库架构更改中,我添加了一些额外的内容 数据也是
  • 我正在尝试运行 使用 Visual 进行补丁/次要/主要升级 Studio 2008 发布和 msi

我想更新用户应用程序和数据库文件,但不触及存储在该数据库中的数据。 看起来很简单,但我无法在网络上找到如何使用 Visual Studio 发布来完成此操作

到目前为止我收集的有 2 个选择:

  • 为每个选项创建 sql 更新脚本 发布并尝试更新数据库 修补后启动第一个程序。
  • 创建数据库安装项目并尝试 从那里编写脚本(不知道如何做到这一点)。

我很高兴听到你们中的一些人正在使用或将使用这种情况。 一些示例链接/详细解释如何做会很棒。 我不太擅长这个部署/数据库的东西......但是......:)

提前致谢。

It's been few weeks I'm trying to find a more detailed explanation with examples how to manage my database change on software patch.

Situation:

  • I deploy wpf application release to
    user. App uses MSSQL data file for
    storing app's data (Deploying with Client Profile and SqlServer Compact 3.5 prerequisites)
  • In further development database schema changes I add some extra
    data too
  • I'm trying to run a
    patch/minor/major upgrade with Visual
    Studio 2008 publishing and msi

I want to update users app and database file, but not touch the data which was stored in that database. Seems easy, but i fail to find on web how to get this done with Visual Studio publishing

What I've collected so far are 2 choices:

  • Create sql update script for each
    release and try update database on
    1st program launch after patching.
  • Create database setup project and try
    to script from there (no idea how to do this).

I'd be glad to hear what some of you are using or would use such case. Some link to examples/detailed explanation how todo would be awesome. I'm not very good at this deployment/database stuff...yet...:)

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

初相遇 2024-07-20 09:54:07

这篇关于“.Net 中的 Rails 样式数据库迁移”的文章可能会有用。 自从 Rails 兴起以来,人们在数据库迁移的最佳实践方面做了很多工作,这些工作可以在其他语言和平台中利用。

This article on "Rails Style Database Migrations in .Net" might be useful. Since the rise of Rails there has been a lot of work on best practices for database migrations, which can be leveraged in other languages and platforms.

苍风燃霜 2024-07-20 09:54:07

如果你将Installer类添加到你的DLL或EXE中,它的Install方法将在安装过程中被调用(详细信息请查看我们的MSDN,VS可以为你制作一个迷你安装项目,然后你只需复制骨架和属性即可)。 然后,您可以针对 CE 运行 SQL 命令并备份现有的 CE 文件,甚至在出现问题时进行回滚(安装程序类具有在整个设置级别上遵循完整跨国步骤的方法 - 这是一件值得考虑的事情:-)

If you add Installer class to your DLL or EXE it's Install method will be invoked during the setup (check our MSDN for details, VS can make a mini setup proj for you and then you can just copy the skeleton and attributes). Then you can run SQL commands against CE and backup existing CE files and even do a rollback if something goes wrong (Installer class has methods to follow full transnational steps on the level of the whole setup - the piece of mind thing :-)

五里雾 2024-07-20 09:54:06

在我当前的项目中,我们使用一种称为持续数据库集成的技术。

我们将所有 sql 更改脚本(可以创建/更改表、存储过程,还可以迁移数据等)收集到 ac# 项目中,并与软件的其余部分同时部署它们。

使用这种技术,我们可以确保所有开发人员数据库也是最新的,因为它集成在 Visual Studio 构建系统中。

我们运行此 MSBuild 脚本进行本地构建和部署。 它检查数据库中的版本号,并运行具有更高版本号的任何脚本。

我不太喜欢 MSBuild,但它可以完成工作。

Martin Fowler 有一篇关于进化数据库设计的文章,其中有一些相关背景知识。

如果您使用 SQL Server Management Studio 进行更改,则可以使用“生成更改脚本”来让它为您编写更改脚本。

In my current project we use a technique called Continuous Database Integration.

We collect all sql change scripts (that can be creating / altering tables, stored procedures, but also migrating data, etc...), into a c# project and deploy them at the same time as the rest of the software.

Using this technique we can ensure that all developer databases are up-to-date as well, as it is integrated in the visual studio build system.

We run this MSBuild script for local builds and for deployment. It checks a version number in the datebase, and runs any scripts with a higher number.

I'm not so fond of MSBuild, but it gets the job done.

Martin Fowler has an article on evolutionary database design which has some background on this.

If you're using SQL Server management studio to make changes, you can use the "Generate Change Script" to let it script the changes for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文