Tutorial - Resolve merge conflicts
Published 20 January 2025
In this example, you and your teammate have both changed the same table. Flyway Desktop will show you if merge conflicts are detected. Let's see what happens:
- Conflicting changes made
- You made a change to your development database. You added a new column - dbo.Employees.LinkedInID. You used Flyway Desktop to save this to disk and commit it locally.
- Your teammate made a change to their development database. They added a new column - dbo.Employees.TwitterID. They used Flyway Desktop to save to disk, commit, and then pushed it to the remote repository.
- In Flyway Desktop, when you try to push your changes, you will get a Merge conflict and you will not be able to Push/Pull any changes until the conflict is resolved. You can click on the object in the Pull/Push list to see the differences.
- Go to the Uncommitted changes in the center. Click on the blue linked filename next to the merge conflict indicator in the list
- In this example, we're using VS Code. Your editor should know this file is in a conflicted state and give you options to resolve the conflict. In this case, you "Accept Both Changes." You may also need to edit the file to fix any SQL syntax, as needed. In this case, you would also need to add a comma after the second to the last column to make the syntax correct. You can then Save your file and close this editor.
→ - Back in Flyway Desktop, the conflict is resolved with a green tick. Note - You may need to close and re-open the differences view to reflect the latest changes in the script.
- If you resolved a conflict on an object in the Schema model, you'll want to go back to the Schema model view and apply these changes to your database. On the Schema model view, click Refresh and select the Apply to database option. Select the object in the list and click Apply to database. Click Continue to confirm you're happy to apply these changes to your development database.
→ - Click back on the Version Control side panel to commit these changes. Select the files, enter a Commit message, and click Commit. You can now Push your change to the remote repository to share with the rest of your team.
→