Recommend Git repo structure for multiple Db's and SQL Instances?

So we have several SQL instances and each will have several Db's my team wants to manage.  There are several cases where changes are needed to more than one Db on a given instance, hence putting every Db on the instance all within the same repo.  Is there a recommended way or structure when several Db's and SQL instances are involved?  Surely not a Git repo per Db?

What Im getting up now

Repo = SQL1
../Db1
../Db2
../Db3

Repo = SQL2
../Db1
../Db2
../Db3

Best Answers

  • AlessandroAlpiAlessandroAlpi Fidenza (PR), ItalyPosts: 91 Gold 2
    Accepted Answer
    Hi @bitshift2,
    choosing a "repo-style" is something which is related to source controlling your database, not related to the production environment you're working on. I suppose that this topic should be covered with a deep discussion on your team, about how to manage source control and branching style of your repositories for the databases themselves. If I got it correctly, you need to answer some questions, like the following ones:
    • is the database "codebase" the same across "some" database?
    • will you deliver a single database with changes in different installations?
    • how will you automate release processes and what is the toolset you're using (or is available for you) right now?
    and si on, they are just some example. Covering this topic is a long-term process within your team and that should be made with your teammates, too.
    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
  • AlexYatesAlexYates Cambridge, UKPosts: 251 Rose Gold 2
    edited November 12, 2018 10:44PM Accepted Answer
    Alessandro is spot on.

    Essentially you need to balance the need to manage all DBs as a single unit (because dependencies) and the need for agility (because if every DB is managed independently you don't need to get everyone to agree to release everything at once).

    In the centralised source control (TFTC/SVN etc) world folks tended to have bigger repos, but in the distributed (git) world folks tend toward smaller, isolated, dare I say, "microservices".

    Basically, if you plan to release DB updates for different dbs independently, you should probably have a repo per DB... Unless that's totally impractical because dependencies. And if that's the case you will probably need to group DBs together, but its also a good sign that you should try to remove some of those dependencies.
    Alex Yates
    DevOps Mentor and Coach

    Director of DLM Consultants
    Co-organisor for Data Relay
    Creator of Speaking Mentors
    Microsoft Data Platform MVP
    Friend of Redgate
    Twitter / LinkedIn
Sign In or Register to comment.