简体   繁体   English

如何在团队中同步存储过程文件和代码

[英]How to synchronize stored procedure files & codes within a team

I have been studying on this matter for few hours and still studying on it. 我已经在这个问题上研究了几个小时,并且仍在研究中。 I'm actually getting lots of info and sources that are not relevant to what I need as I'm not too sure what to search for in google. 实际上,我得到的信息和来源与我需要的无关,因为我不太确定要在Google中搜索什么。

In my company, we use SVN to update and commit our source code and allow each developer in the team who work at the same project to get latest code from each other. 在我的公司中,我们使用SVN来更新和提交我们的源代码,并允许团队中每个从事同一项目的开发人员相互获取最新代码。 This practice works fine without any issue so far. 到目前为止,这种做法效果很好,没有任何问题。

The only problem that concerns me is how to synchronize stored procedures files in the similar method? 我唯一关心的问题是如何以类似的方法同步存储过程文件?

In the past, we face issue like forgetting to get the latest stored procedures from others and we don't even know who change what stored procedure, and deployed the files that without other people latest changes to the client. 过去,我们面临的问题是像忘记从别人那里获取最新的存储过程,甚至不知道谁更改了什么存储过程,以及将没有其他人最新更改的文件部署到客户端上。 So our only workable manual method is to make sure we send our latest stored procedure physical files to everyone to update and make sure they remember to update, which is not so practical and unsafe, because people do forget sometimes. 因此,我们唯一可行的手动方法是确保我们将最新的存储过程物理文件发送给每个人以进行更新,并确保他们记住要更新,这并不是那么实际和不安全,因为人们有时会忘记。

We thought about SVN, but not really work for us because we don't stored our stored procedures in the IDE, and it's not a good concept to store in our IDE as stored procedure is not really code file. 我们考虑过SVN,但对我们而言并不奏效,因为我们没有将存储过程存储在IDE中,并且将存储过程存储在我们的IDE中并不是一个好主意,因为存储过程并不是真正的代码文件。

Highly appreciate if someone could suggest some good practice to share these type of files across people who work in the same project. 如果有人可以建议一些好的做法,以便在同一项目中的工作人员之间共享这些类型的文件,将不胜感激。

Just for information, the IDE we working at is visual studio and we code in c# .Net. 仅供参考,我们使用的IDE是visual studio,我们使用c#.Net进行编码。

My team is similar to yours. 我的团队和你相似。 Actually we manage all stored procedures and table schema SQL files in a folder which is also saved in TFS/SVN. 实际上,我们将所有存储过程和表模式SQL文件管理在一个文件夹中,该文件夹也保存在TFS / SVN中。 Every time when a developer want to change a store procedure, he should get the latest source stored procedure file and edit it in SQL Server Management Studio to edit it. 每次开发人员想要更改存储过程时,他都应获取最新的源存储过程文件,并在SQL Server Management Studio中对其进行编辑以进行编辑。 Then he need to commit the stored procedure files with his code changes. 然后,他需要使用代码更改来提交存储过程文件。 It is also the same when he wants to delete or add stored procedure files. 当他要删除或添加存储过程文件时,也是如此。

Then after each deployment, when a developer finds there is db error blocking his ongoing works, he will find the stored procedure files in the source and run the most recently modified SQL files. 然后,在每次部署之后,当开发人员发现有db错误阻止其正在进行的工作时,他将在源代码中找到存储过程文件并运行最新修改的SQL文件。 The blocking issue should be solved. 阻塞问题应解决。

We're storing all procedures as .sql files in the same folder with the sources that uses it. 我们将所有过程作为.sql文件存储在与使用它的源相同的文件夹中。 The procedures are installed automatically to correct database with each build and a version / build number if added to the end of the procedure so that different versions of the same application can be used with the same database (for testing environments). 将自动安装该过程以纠正每个版本和版本/内部版本号(如果添加到过程末尾)的正确性,从而使同一应用程序的不同版本可用于同一数据库(用于测试环境)。

Having your procedures in version control helps a lot when you have to track down what has been changed or who changed it and of course to get the correct versions installed at the correct time. 当您必须跟踪更改的内容或更改的人,以及当然要在正确的时间安装正确的版本时,将过程置于版本控制中会很有帮助。

In addition to procedures we also store other objects like views, functions, triggers, constraints etc. into version control. 除过程外,我们还将其他对象(例如视图,函数,触发器,约束等)存储到版本控制中。 You could store tables too, but for that we have a special handling because tables can't be re-created, it needs alter table clauses to be executed. 您也可以存储表,但是对此我们有一个特殊的处理方法,因为无法重新创建表,因此需要执行alter table子句。

We're not using SVN, but I would assume the same basic idea would work with it too. 我们没有使用SVN,但我认为相同的基本想法也可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM