About Half Of You Don’t Have Your Databases Under Control.
I ran a poll over on LinkedIn to find out if people have 100% of their databases under some kind of source control or version control.
I broke the answers up into two sets, developers and non-developers, because I had a hunch that the developers’ answers would be very different than the rest, and indeed they were:
Half (36% + 13% = 49%) of the audience says they have 100% of their database structure & logic under source control – and that’s fantastic for them! I love it. That’s actually better than I expected – however there’s a catch, and I’ll talk about that in a second.
Half (23% + 27% = 50%) says they don’t – and while I’d love for that to be different, I understand that it’s really, really hard. I wish databases like SQL Server just had a “put the source control here” option that would automatically check all changes into a repository, along with who made the change and when, so we had a history. The reality is that today’s databases have no built-in integration with source control, which means you’re gonna have to put in some kind of product and process to make that happen.
Half of the audience is better than none, right? Well, not so fast: remember how I split the audience into developers and non-developers? When I’ve discussed this issue with client teams, the developers have often believed everything was in source control, but the DBAs and sysadmins told a very different story. They’d say, “Uh, well, actually, there have been a lot of changes made to the environment post-deployment, especially by support engineers and vendors, and that stuff hasn’t quite made it back to version control.”
So in reality, even though a high percentage of developers believe they’re doing it right, they’re being let down by other people at the company. Hell, you can even be let down by Microsoft themselves! The ever-funny Sean Alexander pointed out:
Because Azure SQL DB can automatically add and remove indexes in your production database without leaving a bread crumb trail behind to undo its work. Don’t get me wrong, I think that’s a good thing for small to midsize businesses who can’t afford to have a DBA paying attention to every database – but it’s amusing that it works against the goals of source control.
If your databases are 100% in source control, great! I’m so happy for you, and you’re doing it right. You should be really proud of yourself and your team for putting in good practices. It’s now up to you to blog, present, and stream about how other companies can follow in your footsteps. There’s a severe lack of online content around how to do this well with SQL Server and the other Microsoft databases.
If not, take heart: you’re not alone. Even in 2024, lots of your peers are still struggling with the same challenge. To read more about their struggles, check out Mala’s recent roundup of SQL source control blog posts.
Related

Hi! I’m Brent Ozar.
I make Microsoft SQL Server go faster. I love teaching, travel, cars, and laughing. I’m based out of Las Vegas. He/him. I teach SQL Server training classes, or if you haven’t got time for the pain, I’m available for consulting too.
Get Free SQL Stuff
"*" indicates required fields



10 Comments. Leave new
Doesn’t MSSQL CDC capture the 5Ws when an activity occurs within a database?
Does that catch changes to stored procedures and indexes? (Honest question, I really don’t know and I’m out on a cruise with super-limited bandwidth.)
sys.objects is your friend . . and yes, I’m a developer with a deep-rooted need to know who’s been buggering about with my babies . .
Russ
Oh, and I also Checksum the source of DB Code objects periodically to detect actual changes . .
Russ
A discution point for context please. What is the benefit of having it in source control? If we need to recreate it, we’ve got backups.
Just because it is in a backup, does not make it correct. Source control shows what is supposed to be in the DB, why it was put in the DB and when it was put in the DB.
Yep! And folks rarely keep the same depth of history for their backups that they keep in source control.
6 out of 5 people lies!
[…] About Half Of You Don’t Have Your Databases Under Control. (Brent Ozar) […]
[…] ???? […]