需要 .NET 数据库版本控制脚本运行程序
我正在查看版本控制数据库,并遇到了有关如何执行此操作的常见文章(编码恐怖、代码颂歌等)。这一切对我来说都很有意义,但是我正在尝试找到一个可以为我运行 sql 脚本的脚本运行程序。所有这些文章都提到有一些东西可以自动运行它们,但没有一篇提出任何建议。
有人知道运行这些脚本的任何实用程序吗?理想情况下,它按以下方式工作:
- 运行事务中的所有内容,因此如果任何单个更新失败,整个事情都会失败
- 我可以控制方案版本数据库表的名称
- 能够拥有一系列始终运行的脚本进行升级
可以作为自动化任务的一部分运行
编辑
开源
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:
- Runs everything in a transaction so if any single update fails, the whole thing fails
- I have control over the name of the scheme version database table
- Ability to have a series of scripts that are always run if an upgrade takes place
Can be run as part of an automated task
EDIT
Open Source
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们在 Web 项目中使用 DbUp 作为脚本运行程序。它简单而漂亮的开源工具可以帮助您使用控制台应用程序方式编写自己的脚本运行器。
我们可以从文件系统中的文件夹运行脚本,或者您可以将它们嵌入到程序集中并作为嵌入脚本运行。
您可以在 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.
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
查看 SSW SQL Deploy - 它似乎可以完成您要做的所有事情要求。它跟踪已执行的脚本,它将一次在多个服务器上运行整批脚本(如果需要),等等。
这是一个非常简单但很漂亮的工具 - 强烈推荐!
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.
It's a pretty simple, but nifty tool - highly recommended!