SqlServer 存储过程和视图的版本控制/代码存储库
对于用于检查存储过程和视图并提供版本控制的 SVN 或 GIT 等价数据库有什么建议吗?
我对开源/免费解决方案感兴趣,但如果您有商业解决方案,最好是低成本的,也请告诉我。
我在这里查看了有关将整个数据库备份添加到代码存储库或比较记录的答案,但这不是我在这里讨论的内容。
我想检查一个存储过程,并检查它以确保同时没有其他人接触过它。
我想了解自上次处理数据访问层以来对存储过程和视图进行了哪些更改(即使对我的代码没有影响)。
Any recommendations for a database equivalent of SVN or GIT for use to check stored procedures and views out and in, and provide version control?
I am interested in open source / free solutions, but if you have a commercial solution, preferably low cost, please let me know also.
I have looked at answers here that talk about adding a entire database backup to a code repository, or comparing records, but that is not what I am talking about here.
I would like to check out a stored procedure, and check it back in knowing that no one else has touched it in the meanwhile.
I would like to see what changes have been made to the stored procedures and views since the last time I worked on the data access layer (even if there is no impact on my code).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们公司使用 Visual Studio Database Edition 来管理我们的数据库架构(架构,而不是数据)。此时,如果没有它,我们就会迷失方向。我们的整个数据库架构由 Microsoft TFS 管理,并且是我们架构的“真相来源”。它的功能远不止于源代码控制,包括数据库验证、测试数据生成、重构等。
很棒的工具。
Our company uses Visual Studio Database Edition to manage our database schema (schema, not data). At this point, we would be lost without it. Our entire database schema is managed by Microsoft TFS, and is our "source of truth" with regards to what our schema looks like. It does much more than source control as well, including database validation, test data generation, refactoring etc.
Great tool.
我们使用 liquibase,您可以在这里找到:
http://www.liquibase.org/
它是开放且可扩展的。根据 Apache 2.0 许可证发布。
这是有关使用 liquibase 管理数据库架构更改的教程:
http://bytefilia.com/managing-database-schema-changes -liquibase-existing-schema/
您应该让源代码管理中的存储库成为唯一的事实来源,并从源代码控制系统定期刷新数据库过程(持续集成)。对存储过程具有写入/创建权限的用户应该是运行 CI 服务的用户。这是确保没有人在数据库中而不是在真实来源(源代码控制)中添加/更改对象的唯一方法
您可以使用 SVN 或 GIT 以及任何 JDBC 数据库设置 liquibase,因此 SQL Server 或大多数其他人也是如此。
We use liquibase which you can find here:
http://www.liquibase.org/
It is open and extensible. Published under the Apache 2.0 license.
and here is a tutorial on managing database schema changes with liquibase:
http://bytefilia.com/managing-database-schema-changes-liquibase-existing-schema/
You should have the repository in source control be the only source of the truth, with a periodic refresh of the database procedures (Continuous Integration) from the source control system. The user with write/create permissions for the stored procedures should be the one CI service runs under. This is the only way you can ensure no one is adding\changing objects in db rather than in the source of the truth (source control)
You can set up liquibase with SVN or GIT, and also any JDBC db, so SQL Server or most others as well.
也许不完全是你的想法 - 但值得阅读这篇文章:
http://www.codeproject.com/KB/architecture/Database_CI.aspx
或谷歌搜索“持续数据库集成”。
从广义上讲,由于模式可以用文本定义,因此任何源代码存储库都可以用来存储它。您可能真正需要的是知道您当前正在查看哪个版本,它是比生产中的版本旧还是新,以及何时发生了哪些更改。 TFS 解决方案为您提供了很多功能,但您也可以推出自己的解决方案 - 尽管您可能需要编写脚本以在各种环境中管理数据库更改。
Maybe not entirely what you had in mind - but it's worth reading this article:
http://www.codeproject.com/KB/architecture/Database_CI.aspx
or googling "continuous database integration".
Broadly speaking, as a schema can be defined in text, any source code repository can be used to store it. What you probably really need is to know which version you're currently looking at, whether it's older or newer than the one in production, and what changes have happened when. The TFS solution gives you a lot of that, but you can also roll your own - though you'll probably need to script the way database changes are managed in your various environments.