Automated way to Linking Multiple Databases using SQL Source Control?

I have probably about 50 databases that I'm trying to move into a GIT repository(Bitbucket). However, it's going to very tedious to one-by-one link these to source control.

Is there any automated way to do this? Even if I have to type the script out and run it manually, that would be fine. I have the full toobelt with DLM Automation but haven't seen anyone link multiple databases at a time

Answers

  • Hey @scalderon,
    I started to write a PoSh script described here. As you can see, you can automate the link using working folder. I'd love to get the git version of the tool, would you like to make some change to my open project? It's also on MVP open projects here.
    Feel free to contact me :-)

    cheers
    Alessandro Alpi
    CTO @ Engage IT Services s.r.l.
    Database Administrator and Team Leader
    Microsoft MVP - Data Platform
    Staff member of getlatestversion.it community
    personal website | blog
  • You may find this useful: https://alessandroalpi.blog/2016/06/28/automatically-link-databases-to-red-gate-sql-source-control/

    I think I've found a suggestion on the Uservoice forum that relates to what you want - if that does sound right please vote for this - if not please create your own suggestion for others to vote on so the developers are aware of the need for the feature!
    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
  • hi @Tianjiao_Li,
    thanks for the mention. That is my blog and the link you're suggesting summarizes the usage of the project I've posted in my previous post.
    so, Thanks :-)
    Alessandro Alpi
    CTO @ Engage IT Services s.r.l.
    Database Administrator and Team Leader
    Microsoft MVP - Data Platform
    Staff member of getlatestversion.it community
    personal website | blog
  • FredWFredW Posts: 1 New member
    AlessandroAlpi

    Thanks for the posted project.

    I downloaded and tried in our environment, and we just want to link the database, without refresh the database from the source control, so we skip the last two optional steps (compare the data structure and data). It ran well, and we can see the database was linked in SSMS, but we got problem when we open the source control commit page, it shows "Get must be installed on this machine" error, and we verified that we already had git added to our path. The link we created by the script all having this issue, but if we create the link in SSMS UI, it works all good.

    Do you have any idea where it might go wrong?

    Thanks!
  • FredWFredW Posts: 1 New member
    AlessandroAlpi

    Thanks for the posted project.

    I downloaded and tried in our environment, and we just want to link the database, without refresh the database from the source control, so we skip the last two optional steps (compare the data structure and data). It ran well, and we can see the database was linked in SSMS, but we got problem when we open the source control commit page, it shows "Get must be installed on this machine" error, and we verified that we already had git added to our path. The link we created by the script all had same issue. But if we create the link under SSMS UI, it works well.

    Do you have any idea where may go wrong?

    Thanks
Sign In or Register to comment.