Options

Understanding Differences in using SQL Compare VS SQL Source Control to compare against repository.

Hello,

I'd like to better understand the difference between the behavior of SQL Compare vs SQL Source Control when it comes to comparing a database's current schema with the schema as it exists in source control. I'm fairly new to using source control and RedGate's products.


Background info:

I have a database which we'll call "Training_DB". This database was originally created based on the schema code present in the MASTER branch of our schema source-controlled repository (GIT). Recently, I created a branch from MASTER which we'll call "HOTFIX-001". I made a few changes to the schema in the Training_DB and used Redgate SQL Source Control to commit those changes to the HOTFIX-001 branch.


Today when I use RedGate SQL Compare, the software notices that compares the HEAD (with currently checked out branch MASTER) to the Training_DB and notices those changes don't exist in HEAD. It also notices 416 other objects which only exist in the DEV branch.


Meanwhile, when I use RedGate SQL Source Control to compare the Training_DB against the MASTER branch, the software reports no objects with changes to be committed. (I'm guessing this is because it recognizes that a commit was already made to a sub-branch of Master? (i.e. HOTFIX-001)


Can anyone help me better understand the difference between the two types of comparisons that are occurring and use cases for using one over the other?


Tagged:

Comments

  • Options
    MikielAgutuMikielAgutu Posts: 29 Silver 1
    edited October 3, 2018 2:02PM
    Hello Syagla

    It seems to me this is what is happening:

    Training_DB is in the state of branch HOTFIX-001. When you check out MASTER, Training_DB of course doesn't change.

    When you compare MASTER to Training_DB in SQLCompare, you see the differences between MASTER and HOTFIX-001. This is what you expect because Training_DB is in HOTFIX-001's state.

    However, when you look at the commit tab in SQL Source Control, you see nothing, despite being on MASTER. This is because SQL Source Control is designed such that all changes you make within SQL Source Control itself are displayed on the commit tab. Changes made outside of SQL Source Control are displayed on the 'Get Latest' tab.

    Therefore, the changes you're expecting ought to be on the Get Latest tab.

    In terms of when you'd use one over another: when developing database changes, you'll want to use SQL Source Control's commit and Get Latest tab. This will allow you to see which changes were made by you, and which were made externally (for instance, by another dev on your team). If you want to compare database schemas without reference to where the changes have come from, use SQL Compare.

    Thanks
    Mikiel Agutu | Software Engineer | Redgate Software
Sign In or Register to comment.