How to use Source Control and preserve ability to restore database from a backup
Yogesh
Posts: 1 New member
I'm new to Source Control too and after following a course on Redgate university, I plan on linking a SQL Server database to Azure Git repository. We have Test, Staging and Prod environments and developers are expected to share the database from the respective environments.
I have access to Test database and plan on creating a baseline of existing database and then I will track new development. My company is used to periodically updating Test & Staging database from Production database. When this happens, will it break the source control link? Has anyone run across such scenario? Can you recommend a workflow to use Source Control and still support database refresh/restore by DBAs?
Thanks for taking time to read and share your thoughts/workarounds.
I have access to Test database and plan on creating a baseline of existing database and then I will track new development. My company is used to periodically updating Test & Staging database from Production database. When this happens, will it break the source control link? Has anyone run across such scenario? Can you recommend a workflow to use Source Control and still support database refresh/restore by DBAs?
Thanks for taking time to read and share your thoughts/workarounds.
Tagged:
Answers
SQL Source Control is able to work with branches, and we even have a couple of documentation pages covering this:
https://documentation.red-gate.com/soc/common-tasks/working-with-branches
https://documentation.red-gate.com/soc/common-tasks/working-with-branches/merging-branches
In regards to your question about test being updated from production, this shouldn't break your link in SQL Source Control. You will simply need to pull down the changes from the 'Get Latest' tab when you are connected to the test branch if changes are made on the repo, otherwise you will just push the changes to the repo from SQL Source Control. This should merge the changes that were pushed from prod into your test repository on the database/repo level.
In terms of a workflow, that's hard to say. One recommendation I have is that developers should work on feature branches or separate development branches when making database schema changes. This ensures that changes are isolated and can be merged easily. I would then consult the documentation about merging branches as it explains how that is done. Other than that, do you have any specific questions about what you might want to achieve?
Kind regards,
Kurt McCormick
Product Support Engineer, Redgate
Need help? Take a look at our Help Center