Put your Database under Source Control

  • thomasliddledba

    Ten Centuries

    Points: 1190

    Comments posted to this topic are about the item Put your Database under Source Control

    Thomas Liddle
    SQL Server Administrator
    Video Blog - YouTube
    Web Blog - www.thomasliddledba.com
    Twitter - @thomasliddledba
    Facebook - @thomasliddledba

  • rgp151

    SSC Veteran

    Points: 297

    thomasliddledba - Wednesday, January 18, 2017 12:03 AM

    Comments posted to this topic are about the item Put your Database under Source Control

    The Red Gate tools look nice, but we've actually done something where we've created a nightly job that scripts out all of the objects in every database on our SQL server to a folder structure on a network drive, and then runs GIT, which checks in any files that have changed since the previous night. This gives us automatic DDL backups of everything, and it's pretty nice.

  • browndog

    SSC Enthusiast

    Points: 175

    Nice article.  Please note that with Visual Studio you can also use SSDT and source control your database project.  VS now integrates with GIT nicely so it can be the source repository

  • thomasliddledba

    Ten Centuries

    Points: 1190

    rgp151 - Wednesday, January 18, 2017 4:50 AM

    thomasliddledba - Wednesday, January 18, 2017 12:03 AM

    Comments posted to this topic are about the item Put your Database under Source Control

    The Red Gate tools look nice, but we've actually done something where we've created a nightly job that scripts out all of the objects in every database on our SQL server to a folder structure on a network drive, and then runs GIT, which checks in any files that have changed since the previous night. This gives us automatic DDL backups of everything, and it's pretty nice.

    rgp151 - That's a great way to perform backups of DDL's in all your databases.  I hope you can share the code.  🙂  Another way to think about this is from a development perspective.  In my world as a DBA, I support a common database on each of the servers I manage.  The two teams (Engineering and Operations) we are always tweaking code and use the RedGate Source Control/Jenkins to source control and deployement.

    I use the SVN repository we have (moving to GIT really soon) as my backup/version control.

    I've always been in the mindset with Database Administration is that there are 1000 ways to skin a cat.  I like your thought process.

    Thomas Liddle
    SQL Server Administrator
    Video Blog - YouTube
    Web Blog - www.thomasliddledba.com
    Twitter - @thomasliddledba
    Facebook - @thomasliddledba

  • thomasliddledba

    Ten Centuries

    Points: 1190

    browndog - Wednesday, January 18, 2017 6:51 AM

    Nice article.  Please note that with Visual Studio you can also use SSDT and source control your database project.  VS now integrates with GIT nicely so it can be the source repository

    browndog - Thanks.  I'll need to do some more research with VS and GIT to become familiar with it.

    Thomas Liddle
    SQL Server Administrator
    Video Blog - YouTube
    Web Blog - www.thomasliddledba.com
    Twitter - @thomasliddledba
    Facebook - @thomasliddledba

  • rgp151

    SSC Veteran

    Points: 297

    browndog - Wednesday, January 18, 2017 6:51 AM

    Nice article.  Please note that with Visual Studio you can also use SSDT and source control your database project.  VS now integrates with GIT nicely so it can be the source repository

    True, BUT, this assumes all DDL changes are taking place though SSDT. If that's true then this works just fine, but in many environment many changes can and do take place outside of SSDT. The nice thing about the approaches being discussed is that they will version ALL DLL changes to source control, regardless of how they were performed. 

  • browndog

    SSC Enthusiast

    Points: 175

    rgp151 - Wednesday, January 18, 2017 9:40 AM

    browndog - Wednesday, January 18, 2017 6:51 AM

    Nice article.  Please note that with Visual Studio you can also use SSDT and source control your database project.  VS now integrates with GIT nicely so it can be the source repository

    True, BUT, this assumes all DDL changes are taking place though SSDT. If that's true then this works just fine, but in many environment many changes can and do take place outside of SSDT. The nice thing about the approaches being discussed is that they will version ALL DLL changes to source control, regardless of how they were performed. 

    Agreed.  You'd have to do a compare in the SSDT database project from source to the target DB to catch any changes made outside of the SSDT

  • David Atkinson

    Ten Centuries

    Points: 1126

    rgp151 - Wednesday, January 18, 2017 4:50 AM

    thomasliddledba - Wednesday, January 18, 2017 12:03 AM

    Comments posted to this topic are about the item Put your Database under Source Control

    The Red Gate tools look nice, but we've actually done something where we've created a nightly job that scripts out all of the objects in every database on our SQL server to a folder structure on a network drive, and then runs GIT, which checks in any files that have changed since the previous night. This gives us automatic DDL backups of everything, and it's pretty nice.

    @rgp151 - have you taken a look at DLM Dashboard, a free Redgate tool which uses the same approach? If it doesn't do what you want I'd be keen to understand why.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply