For efficient team-based database development, and reliable and repeatable database deployments, source control is not optional. The job of a source control system is to maintain a change history of all the files in a project. As soon as we enter a new file into source control, the system assigns it a version. Each time we commit a change to that file, the version increments, and we have access to the current version and all previous versions of the file. For good reason, we often refer to a source control system as a version control system, or VCS.
Few software developers would consider building an application without the benefits that a VCS offers, but its adoption for databases has been slower, partly because of the added complication of the need to preserve data during database upgrades. However, unless we have in the VCS the correct versions of all the scripts necessary to create our database objects, load lookup data, add security accounts, and take any other necessary actions, we have no hope of a reliable and repeatable database deployment process, let alone of coordinating database upgrades with changes to the associated application. We also run a very real risk that our “ad hoc” database patching will cause inconsistencies and data loss.
Version control can and should play a key role in the database development and deployment process, and this book will show you exactly how to get started. It provides “just enough” detail about the core components of a source control system, and the operations that allow us to commit our database changes and retrieve others’ changes. It then focuses on getting a database into source control and working with it, covering:
– Database source control architecture – what needs to be in there, how to structure it all.
– Collaborative editing – working as a team on a database project, while minimizing the potential for conflicting changes and data loss.
– Change auditing – what changed between one version and another, and who changed it?
– Branching – allows teams to work independently on separate features, and control what they deploy and when.
– Merging – what happens if one user changes the name of a column while another updates its data type? A merge operation lets the team decide the correct outcome.
– Building and deploying databases – building new databases and upgrading existing databases from source control, both manually and using automation tools.
Every chapter follows the same “half theory, half practice” template, so you learn the concepts and then immediately see how they work in a particular source control system, in this case, Subversion (SVN).
Table of Contents
- Chapter 1: Core Source Control Concepts
- Chapter 2: The Source Control Repository
- Chapter 3: Getting Started with Source Control for Databases
- Chapter 4: Editing and Versioning
- Chapter 5: Branches and Tags
- Chapter 6: Merging
- Chapter 7: Manually Deploying Databases from Source Control
- Chapter 8: Automating Database Versioning and Deployment from Source Control