Manage multiple branches in SQL Server database project using VS data tools.

Paul Hernandez 631 Reputation points Microsoft Employee
2021-09-02T14:56:30.887+00:00

Hi everyone,

is there any best practice to manage multiple branches of an SQL server database project.

Sample scenario:

  1. There is a main branch
  2. Developer A creates a branch A
  3. Developer B creates a branch B
  4. Developer A creates a pull request and merge let's say a new table into main.
  5. Developer B creates a pull request containing another new table.

The problem by the second pull request is the project file. File for different sql objects are not getting in conflict since every new table gets a dedicated file in the correspondent schema folder. From the other side the project file in Main points to the table created by user A but does not contain the table in the pull request and viceversa.

Until now we are overcoming this drawback merging the project file manually but I want to double check if there is a better way to proceed.

Any help will be appreciated.

Best regards,
Paul

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,082 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Tom Phillips 17,716 Reputation points
    2021-09-02T19:12:57.24+00:00

    Normally the merge takes care of that. It sounds like you are getting a merge conflict, and instead of merging the changes, you are accepting one or the other project file.

    0 comments No comments

  2. CathyJi-MSFT 21,111 Reputation points Microsoft Vendor
    2021-09-03T05:56:36.4+00:00

    Hi @Paul Hernandez ,

    Did you mean that branch strategies in source control system? If I misunderstood, please let me know.

    Please check if below blog could help you.

    Branching in Git with SQL Database Projects

    0 comments No comments

  3. Paul Hernandez 631 Reputation points Microsoft Employee
    2021-09-03T13:52:59.147+00:00

    Hi @CathyJi-MSFT and @Tom Phillips ,

    thanks for the feedback.

    Yes, I am getting a confilct while creating the second pull request.

    It is not exactly about the branching strategy (which is behind this) but a technical solution to solve the PR conflicts.

    I solved this problems manually.

    Example confilct:

    128957-image.png

    In this case, just delete the comment in the windows on the bottom and click on “Submit Merge”.

    129154-image.png

    After that merge is applied and the conflict resolved:

    128958-image.png

    This is find but I fix manually the conflicts, which could be error prone in large features with more changes and just wanted to know if there is a kind of magic that auto resolves this specific conflict with the project files.

    Best regards,

    Paul