Recipe 14Implementing Database Version Checking

Problem: Why can't the database tell me what version it's running?

When you have many change scripts that must be applied in a certain sequence, tracking which change script has been applied to which database can be a huge problem. It would be helpful if you could have your application check whether it's running against the correct database version, such as "Application build 1789 shouldn't run against the database built for application build 1237."

Solution

All the naming strategies for change scripts—BuildNumber, TimeStamp, UniqueIdentifier, and Release—use a table to track changes being applied to the database, such as this Version table:

The Version table tracks versionname, a logical name ...

Get Recipes for Continuous Database Integration: Evolutionary Database Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.