需要 .NET 数据库版本控制脚本运行程序

发布于 2024-08-16 03:44:43 字数 362 浏览 2 评论 0原文

我正在查看版本控制数据库,并遇到了有关如何执行此操作的常见文章(编码恐怖、代码颂歌等)。这一切对我来说都很有意义,但是我正在尝试找到一个可以为我运行 sql 脚本的脚本运行程序。所有这些文章都提到有一些东西可以自动运行它们,但没有一篇提出任何建议。

有人知道运行这些脚本的任何实用程序吗?理想情况下,它按以下方式工作:

  1. 运行事务中的所有内容,因此如果任何单个更新失败,整个事情都会失败
  2. 我可以控制方案版本数据库表的名称
  3. 能够拥有一系列始终运行的脚本进行升级
  4. 可以作为自动化任务的一部分运行

    编辑

  5. 开源

I'm looking at versioning databases and came across the usual articles regarding how to do this (coding horror, ode to code, etc). This all make perfect sense to me, however I'm trying to find a script runner that will run the sql scripts for me. All these articles mention having something to run them automatically, but none of them make any recommendations.

Does anybody know of any utilities for running these scripts? Ideally something that works in the following way:

  1. Runs everything in a transaction so if any single update fails, the whole thing fails
  2. I have control over the name of the scheme version database table
  3. Ability to have a series of scripts that are always run if an upgrade takes place
  4. Can be run as part of an automated task

    EDIT

  5. Open Source

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

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

发布评论

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

评论(2

败给现实 2024-08-23 03:44:43

我们在 Web 项目中使用 DbUp 作为脚本运行程序。它简单而漂亮的开源工具可以帮助您使用控制台应用程序方式编写自己的脚本运行器。

DbUp 是一个 .NET 库,可帮助您将更改部署到 SQL Server
数据库。它跟踪哪些 SQL 脚本已经运行,并运行
使数据库保持最新状态所需的更改脚本。

我们可以从文件系统中的文件夹运行脚本,或者您可以将它们嵌入到程序集中并作为嵌入脚本运行。

您可以在 github 上的代码存储库中找到更多信息和示例。

http://dbup.github.com

We Use DbUp as Script Runner in our Web Project. Its simple and nice open source tools that help you to write you own script runner with Console Application fashion.

DbUp is a .NET library that helps you to deploy changes to SQL Server
databases. It tracks which SQL scripts have been run already, and runs
the change scripts that are needed to get your database up to date.

we can run scripts from folder in filesystem or you can embed them to your assembly and run them as embedded scripts.

you can find more information and sample on their code repository on github.

http://dbup.github.com

独享拥抱 2024-08-23 03:44:43

查看 SSW SQL Deploy - 它似乎可以完成您要做的所有事情要求。它跟踪已执行的脚本,它将一次在多个服务器上运行整批脚本(如果需要),等等。

alt text

这是一个非常简单但很漂亮的工具 - 强烈推荐!

Check out SSW SQL Deploy - it would appear to do just about all you're asking for. It keeps track of already executed scripts, it'll run a whole batch of scripts at once and on multiple servers (if required), and so forth.

alt text

It's a pretty simple, but nifty tool - highly recommended!

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