How to address resolve merge conflicts in the .sqlproj <DeployChangesExecutionOrder> line?
Shaggy
Posts: 16 Bronze 1
Scenario:
Consider the following sequential timeline of events:
Questions:
Thanks in advance for your support.
Consider the following sequential timeline of events:
- Dev A - creates branch (BR1) from master.
- Dev B - creates branch (BR2) from master.
- Dev B - creates a stored procedure in BR2, generates a migration script, commits locally, and pushes to origin.
- Dev B - does a pull request to successfully merge changes to master. - Yay!
>> Thus, master is now different from when Dev A created branch BR1. <<
>> Branch BR2 activity is complete. << - Dev A - creates a stored procedures in BR1, generates a migration script, commits, pushes, etc.
- Dev A - is presented with a merge conflict when attempting the pull request on the <DeployChangesExecutionOrder> line in the .sqlproj file.
Questions:
- What is the best way to address the merge conflict?
- Is there a way to eliminate the <DeployChangesExecutionOrder> line from the .sqlproj file?
Thanks in advance for your support.
Tagged:
Best Answers
-
Kendra_Little Posts: 139 Gold 3Hi @Shaggy ,
Sorry for the delay on this one.
For your second question, if there is a way to remove DeployChangesExecutionOrder, I am not knowledgeable about this one and am going to defer this one to other team members.
For your first question, the best way to deal with the merge conflict, here's what I recommend:
A) In general it's good for DevA and DevB to regularly merge to their branches from trunk (or where-ever they are eventually going to merge TO), if their branches will be updated on a regular basis. This way they can be aware of other changes as they happen and not have to find out about them all at the end.
It's also best for both DevA and DevB to do that merge again right before they create the pull request. That way they can review the conflict locally and handle it.
C) If there's a race condition and someone merges in right before you, the Pull Request will notify you of the conflict as you mention. In this case I'd go back to the local repo, handle the conflict, and re-push.
For handling the conflict locally, if you're using the SSMS plug-in, we recommend the free VSCode as a merge tool if you don't already have a favorite.
To handle the conflict:- In the trunk branch, pull changes
- Change to the branch in question (in this case BR1)
- Merge changes from trunk into BR1 -- in the example where trunk is named master: git merge master
- Open the sqlproj file with the conflict and merge the changes, in this case we would accept both (image below)
- Stage and commit
- Push
Hope this helps,
Kendra -
Pete_Ruiz Posts: 123 Silver 4Hello @ShaggyI've escalated this to our developers who provided the following comments to your questions.
1. What is the best way to address the merge conflict?
If they have <EvaluateExecutionOrderOnImport> set to True, then they can remove the <DeployChangesExecutionOrder> line completely, and re-open the project, which should then
result in it being regenerated. Although they should only do this if they haven't manually altered the deployment order.
Alternatively, if they are using a manually ordered deployment order then they'll have to resolve the conflict manually.
2. Is there a way to eliminate the <DeployChangesExecutionOrder> line from the .sqlproj file?
Currently, if it isn't present in the .sqlproj file, then SCA should auto-generate it, which means it's not possible to have a project without this line at all.
However, the line is still valuable, as changes can still be made that may require a different ordering.I hope this is helpful. Please let me know if you have further questions.Kind regards,Pete Ruiz
Answers
Note: We've been using the SOC/state approach for 2-years, and we are currently evaluating SCA/migrations on a greenfield project. Kicking the tires so to speak before converting.
How could this possibly scale on larger teams?
Thank you for the feedback on this.
The structure of the project file within the existing implementation of SQL Change Automation is pretty integral to the implementation, and this would be a tough thing for us to change for existing implementations/projects.
We are currently working on previews of our next-generation tooling for Database DevOps, and the solution will provide the ability to deploy via migrations without needing to track a list of scripts inside a project configuration file.
Would you be interested in joining our research program as we develop this tool? If so, please drop our team a note at databasedevops@red-gate.com.
Cheers,
Kendra
I would still say that a user doing the merge can still be flawed so there for the answer by @Pete_Ruiz
to remove or leave the line empty and have SCA re-generate the order is the best answer (there is a button to generate in the project property screen) for my use.
No way are we going to go back to SQL Source Control, ReadyRoll (older SCA name) was the biggest win we came across when we went to Build2018.