SQL Source Control for teams
You'll use SQL Source Control differently depending on which development model you're using:
不同的模式有不同的使用方式
The dedicated model
In the dedicated model, each developer has their own copy of the database.
If this is what you're doing, read Teams using the dedicated model.
The dedicated model is where each developer works on a separate copy of the database.
这种模式,每一个人(是指每一个集成了sql source control的sql server instance)只能连接到一个数据库上。
The shared model
In the shared model, developers work on a single copy of the database.
If this is what you're doing, read Teams using the shared model.
The shared development model is where developers work on a single copy of the database.
这种模式下,每一个人都连接到同一个数据库。所有的操作,直接在数据库操作。
每个人负责commit自己 修改,并且修改之前最好使用object lock的功能。
如果想要把数据库的变化apply到其他数据库,除非新建一个sql server instance(和sql source control集成过的),来连接到其他数据库。
然后link sql sourcecontrol,在进行处理。
总结:
每一个sql server instance只能连接到一个数据库上。假如连接到多个数据库的话,就会出现使用混乱的问题。
应该是,可以连接到多个数据库,但是仅仅只能在其中某一个数据库上进行修改,不能一会修改这个,一会修改那个。
正确的操作是,直接操作数据库,需要固定某一个数据库。然后把修改apply到其他的数据库上。
注意事项
一次只能在一个模式下开发,切忌两种模式混用。
不恰当的使用举例,假设有服务器的数据库DB1,用户A自己本地有数据库DB2。
用户B使用shared模式,直接在DB1进行修改。
用户A使用dedicated模式,在DB2进行修改,再通过sql source control把修改apply到DB1上。
这种混用导致的问题是,如果用户B在服务器上添加了一个存储过程,name在用户A连接到DB1上的时候,commit tab上看不到新增。
却会在get latest上看到那个存储过程需要drop。
解决方法:先把DB1和数据库的git repository进行unlink。然后再重新link。
冲突的处理
如果遇到冲突,可以一般会有2个选择,take mine 或者take theirs
如果想要做合并的,需要使用第三方工具,处理好之后,再标记resolve
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2017-03-02 BsonDocument
2016-03-02 ReSharper warns: “Static field in generic type”
2016-03-02 FileStream StreamWriter StreamReader BinaryReader
2015-03-02 Setup Entity Framework Environment
2015-03-02 What is Entity Framework?