Git has radically changed our perspective on branching and merging, distributed development, and the value of treating everything as code. Git users are able to rapidly branch and merge code to support non-linear development. With local repositories, Git supports widely distributed development teams that are no longer dependent on network resources. Our environments are now being described in code stored in Git repositories.
All of these benefits can be shared with our database developers and database administrators with just a few shifts in focus.
The first shift is that we must store all our environment changes (code, database schema changes, and environment config) in Git. We can no longer have multiple systems of record. Prior to Git, we were slowed by the network requirements of other version control systems. We didn’t want to store large amounts of information in the repository because pulling it down took too long. Now, with local repository access with Git, we see several orders of magnitude in performance improvement.
To that end, by storing our code and database changes in one location, we can benefit from the atomicity of the change. No longer are we concerned with which version of the code changes goes with which version of the database changes. Life is too short to have to worry about multiple systems of record.
Secondly, manual review of database changes at every stage needs to stop. Nowhere in our software development lifecycle do we review code changes after a build and release to test. Sure, we have code reviews in development — and thanks to Git’s rapid branch and merge capabilities, we can easily do that. However, we are not performing the same code reviews with our database changes.
Consider this: what impact would a system administrator reviewing code changes prior to deployment have on our deployment times? Of course, deployment times would expand. However, I’m sure you are most concerned with why a system administrator is reviewing code changes. Commonly, we have our Database Administrators perform this same review.
Forcing a review of database schema changes at every point proves that your current process and tooling is unable to guarantee quality and safety of the change. Until you can avoid this, you are not moving at Git speed.
Finally, relying on SQL scripts alone is foolish. The problems inherent to deploying SQL scripts are twofold. The first issue that you are faced with an incomplete execution of a series of scripts. You have no guarantee that your SQL scripts will execute properly in a target environment (which probably explains why you are manually reviewing today.) Secondly, if there is a failure that requires some rollback, you are left with manually exiting the deployment. Of course, you can mitigate that by requiring rollback scripts, but enforcing that is another headache and burden for an already overworked database team.