Let me tell you about a conversation I had yesterday with some developers in a team. They needed help with their database CI/CD process, and so I wanted to see the database solutions they were using.
Dev1: We don’t have solutions at the moment.
Me: OK, how come?
Dev1: Because we are making so many changes right now, there seemed to be little point in creating solutions, so we’re just using scripts.
[At this point, I bite my tongue and choose not to reply with ‘If you’re continuously making changes, wouldn’t it make sense to continuously integrate and continuously deploy the changes. I mean, you’d hardly be taxing the definition of the word “continuously…” now are you…']
Me: So how are you making changes?
Dev1: Oh well, we’re just using scripts to deploy the changes now.
Me: And where are the scripts?
Dev1 They’re in the wiki.
Dev2: No they’re not, because we put anything in the wiki that is changing regularly.
Dev1. Oh. So where are they?
[Dev2 stares blankly].
Dev1: So why do you want solutions?
Me: To help you build a release pipeline.
Dev2: But we’re making lots of changes regularly.
[Again, me, keeping cool in spite of the blindingly obvious contradiction presented to me.]
Me: But let’s get something built to help you make those changes regularly.
Dev1: OK, I’ll get something together by the end of the week. In the meantime we’re too busy making changes to get this together…
Sound familiar? I’m sure many of you have been in a situation like this before. It’s not the first time I’ve had a conversation like this either.
Now I can go on about how the business doesn’t buy into maintenance, or Continuous Integration or Continuous Delivery. Or I could talk about how CI/CD needs to be pushed by the devs and that associated tasks require items in the sprint to make sure that they are completed and audited. And I can talk about how the “build once, deploy many” process reduces the number of bugs and speeds up the deployment process. And you know, it is great that when wearing my DBA hat I have had to write wacky scripts because dev teams haven’t been deploying to environments in a controlled manner, but I’d really rather be focusing on infrastructure. All these points are well documented.
But these points are consequences of implementing (or not) Continuous Delivery and Continuous Deployment. The most fundamental point of adopting CI/CD is getting your code into some sort of source control. It all starts with getting the code into source control, writing pre and post deployment scripts that are re-runnable, developers checking in changes, building the code, and taking the resulting artefact (in SSDT terms, a dacpac) and deploying that dacpac to your database. And taking the same dacpac and deploying again and again up to production. This process can be achieved in an hour. Actually, in 55 minutes! And AdventureWorks can be tough to automate! OK, it may take longer than that, but getting a repository of your code that can be audited, changes rolled back, tagged, branched, deployed, merged etc etc is the first step towards achieving Database DevOps.