Taming the Database Database Version Control
Feb 23, 2016
Taming the Database
Database Version Control
UNKNOWN CHANGESWhat the _ is this column?
SHARED DEV DB
Hey who dropped that table?Who changed my test data?
MANY VERSIONS OF THE “TRUTH”Time to release, where are the changes?
PRODUCTION ARTIFACTSHey who added a new procedure to production?
MANUAL DEPLOYFriday night: I can’t go out I have to do a release at midnight
PATTERN: LOCAL DEV DBBecause you wouldn’t dream of sharing the same code checkout…
END OF RELEASE DIFF-ATHONWhy am I going bald?
UNTESTED CHANGESYSOD
TELECOMMUTING IS PAINFULExcuses
PATTERN: AUTOMATED MIGRATIONSHeaven
Migrations
• Baseline• SchemaChanges• Going forward– Change script– Commit
Continuous Integration
Automated Deploys
The Whole Picture!
Baseline Schema
SHARED DEV DB?Or local?
WHEN DO YOU ADDRESS DATABASE CHANGES?
Commit with code into VCSRoad blocked team memberEnd of releaseNever
Add Table CustomerTypes
Add Procedure
CREATE PROCEDURE GetCustomerNames ASBEGIN
SET NOCOUNT ON;SELECT Id, CompanyName from Customers
END