https://documentation.red-gate.com/display/SOC5/SQL+Source+Control+5+documentation

SELECT DB_NAME(DatabaseID) AS DatabaseName ,
UserName ,
*
FROM dbo.RG_AllObjects_v4
WHERE UserName IS NOT NULL
ORDER BY EntryDateTime ASC

EntryDateTime是第一次加入dbo.RG_AllObjects_v4中的时间,后面每一次修改是更新modify date。

删除操作之后,第二次再添加的话,会重新加一条新的记录

SELECT *
FROM dbo.RG_AllObjects_v4
ORDER BY ModifyDate DESC,
EntryDateTime ASC; SELECT *
FROM dbo.RG_AllObjects_v4
WHERE ObjectName = 'DeleteAllData';

Working with migration scripts

What are migration scripts?

To deploy changes from version control, the SQL Compare engine generates a deployment script. This is based on the differences between the state in version control and the target database. Migration scripts in version control can define how the SQL Compare engine generates specific sections of this deployment script.

Migration scripts are necessary to avoid data loss when making certain schema changes. To achieve this, the migration script intervenes to make data changes occur at the right point of the deployment.

In most cases, you only need to write SQL for the data changes in the migration script. Schema changes are committed separately and deployed as normal.

To learn more, see Migration script examples.

Deploying migration scripts

SQL Compare 11 or later can generate deployment scripts with migrations using the following source/target types:

Source:

  • Scripts folder
  • Source control

Target:

  • Live database
  • Scripts folder

We recommend using SQL Compare to deploy changes to production, as you have the opportunity to review the deployment script before it's deployed. For a full walkthrough of the deployment process using SQL Compare, see Migration script examples.

It is possible to use the Get latest function in SQL Source Control to deploy these changes, however we don't recommend linking your production database directly to source control.

Dependencies

When you create a migration script that includes uncommitted schema changes, SQL Source Control automatically includes any dependencies. Deselecting any of these dependencies during the deployment stage will cause the deployment to fail.

Static data

Migration scripts do not work with static data. See Static data and migrations.

Deploy a database from source control

To deploy a database from source control to a server, use SQL Compare Pro, or the SQL Server Management Studio Integration Pack add-in.

Deploying with SQL Compare

To deploy with SQL Compare:

    1. Open SQL Compare.
    2. Select a version from source control.
      For full instructions, "Selecting a version from source control" on the Setting data sources page (SQL Compare documentation).
    3. Run the comparison.
    4. Open the Deployment Wizard and deploy the version.
      For full instructions, see Deploying data sources (SQL Compare documentation).

sql source control在client 和server之间进行还原

1.建立2个分支local 和master

2.确保没问题的,提交在master分支上,测试的可以提交在local上

3.local和master分支,是可以fast-forward。master在前,local在后

4.通过切换分支,切换到local分支,可以将local上的代码,apply到server上

最后2个存储过程是新增的。当前切换到local分支,可以在右上角确认

5.切换到master分支,可以undo changes之前apply到server上的代码

其中第1个和第2个存储过程是新增的,所以现在还原,是删除操作

其中第4和第5,都是在get latest界面进行操作

Client和Server之间进行处理,detach本地的数据库,将服务器上的数据库备份好之后,restore到本地

假设服务器的分支提交为C1,C2,C3,然后还有没有提交的修改

假设本地分支的提交为C1,C2,C3,C4,C5。

restore服务器数据库到本地后,本地的数据库的实际内容变成C1,C2,C3以及未提交的修改。

那么restore到本地之后,在commit的选项卡上,会发现,sql source control 会认为C5才是正确的版本,然后C3和C5之间的差异,会变成一次modify。

这次modify相当于,把C5修改回C3了,所以要让本地的数据库,同步到C5的修改,需要做一次undo changes。

同时维护2个分支

Filter的优先级最高

如果在get latest的tab中看到filter的话,优先apply filter。否则会导致一些意外的问题

升级

如果在Management Studio看到sql source control升级提示的话,

首先需要切换到国外的代理,然后再点击升级按钮。否则是无法升级成功的

object changed by unknown

https://documentation.red-gate.com/soc6/troubleshooting/object-changed-by-unknown

By default, SQL Source Control reads information about who made changes from the default trace and saves it in tempdb. However, because tempdb is reset when the server is restarted, information about who made a change is eventually lost.

Fix

To stop the information being lost, you can create a database to log changes instead of tempdb.

https://documentation.red-gate.com/soc6/configuring/log-changes-to-shared-databases

Step 1: Creating the change log database

Step 2: Editing the config file

SELECT DB_NAME(DatabaseID) AS DatabaseName,
*
FROM dbo.RG_AllObjects_v4;

上面的配置有时候会失效,不管怎么操作都是unknown。可能是服务器上的sql server的服务有问题导致的,只需要重新启动一下sql server的服务,就可以正常记录user是谁。

sql source control对应的git repository目录更换了,需要批量替换

echo %userprofile%\AppData\Local\Red Gate\SQL Source Control 7\LinkedDatabases.xml

C:\Users\clu\AppData\Local\Red Gate\SQL Source Control 7\LinkedDatabases.xml

ignore pattern

ignore user,role, and schema

https://www.cnblogs.com/chucklu/p/9466382.html

SQL Source Control的更多相关文章

  1. Red Gate - SQL Source Control实现对SQL SERVER 的源代码控制

    原文地址:http://bbs.csdn.net/topics/350165431 SQL Server 一直没有一款很好的源码控制器,之前自己曾尝试自己写一个,将所有的 脚本 自动生成到某一目录下, ...

  2. Red Gate系列之二 SQL Source Control 3.0.13.4214 Edition 数据库版本控制器 完全破解+使用教程

    原文:Red Gate系列之二 SQL Source Control 3.0.13.4214 Edition 数据库版本控制器 完全破解+使用教程 Red Gate系列之二 SQL Source Co ...

  3. ignore users and roles by filter in sql source control

    https://www.red-gate.com/hub/product-learning/sql-source-control/source-controlling-database-permiss ...

  4. How to use shared model by git in sql source control of red gate

    1.clone the git repository for datbase 2.open sql source control window and select the target databa ...

  5. SQL Source Control for teams

    You'll use SQL Source Control differently depending on which development model you're using: 不同的模式有不 ...

  6. edit filter rules in sql source control

    https://documentation.red-gate.com/soc6/common-tasks/exclude-objects-using-filters 如果有人上传了filter,nam ...

  7. Link static data in sql source control

    You can link data that doesn't change very often to SQL Source Control. This lets you commit data ch ...

  8. sql server 2012中red gate的sql source control消失

    找到C:\ProgramData\Microsoft\SQL Server Management Studio\11.0\Addins路径,用notepad++打开RedGate.SIPFramewo ...

  9. Visual Studio 2013 always switches source control plugin to Git and disconnect TFS

      A few days ago, I've been facing a strange behavior with Visual Studio 2013.   No matter what solu ...

随机推荐

  1. 树上倍增求LCA

    大概思想就是,节点$i$的第$2^{j}$个父节点是他第$2^{j-1}$个父亲的第$2^{j-1}$个父亲 然后可以$O(nlogn)$时间内解决…… 没了? //fa[i][j]表示i的第2^j个 ...

  2. MFC基础知识

    1.句柄:具有内存后,系统返回的标识符 2.消息:相当于事件,例如鼠标点击就是一个消息 3.消息队列:就是将事件按照时间的先后顺序在一个队列中 4.消息处理机制:首先操作系统拿到消息,然后将消息放到消 ...

  3. 华为P30系列新增“无线投屏”功能

    3月26日法国巴黎全球首发之后,4月11日华为又移师上海举办2019春季新品发布盛典,新一代拍照旗舰P30.P30 Pro正式登陆国内. 除了感光徕卡四摄带来的“彩色夜视仪“+“望远镜”的震撼拍照效果 ...

  4. #undef 的用法

    在Visual Studio2008中编写如下代码: #include <iostream> using namespace std; int main() { #define MODI ...

  5. mysql中文乱码解决方式

    近期项目使用到mysql.却突然出现了中文乱码问题.尝试了多种方案,最终解决乱码问题,总结一下解决方式,给遇到同样问题的人一点參考. 中文乱码的原因 1.安装mysqlserver的时候编码集设定有问 ...

  6. 在Windows上面安装多个Memcached

    在Windows上面安装多个Memcached sc create "memcached Server3" start= auto binPath= "D:\memcac ...

  7. Android控件篇

    Android中提供了丰富的UI空间.为了最大限度地发挥平台的性能.每个开发人员必须熟练掌握UI控件尤其是经常使用的UI控件.并能依据须要呈现的内容选择最恰当的控件. Android提供了XML配置和 ...

  8. hibernate动态表名映射--仅仅有想不到,没有做不到

    近期的一个项目有一个需求,有N个考核单位,要对每一个考核单位生成一张考核情况表.这样做的目的是横切数据库,这这个需求的实现中,我的组员遇到了一个技术问题,我将我的解决的方法和整个思考过程与大家分享, ...

  9. 曲根英语万词---二、evoke

    曲根英语万词---二.evoke 一.总结 一句话总结:evoke v.唤起,引起 词根:-voc-, -vok- [词根含义]:声音,叫喊 1.consecrate? v,供奉,奉为神圣 -ate, ...

  10. 42.angularJS自定义服务

    转自:https://www.cnblogs.com/best/tag/Angular/ 1. 你可以创建自定义服务,链接到你的模块中: <!DOCTYPE html> <html& ...