Overview
Sundog Database Refactoring Tool (SDRT) is a DBMS-independent tool for the agile developer working with databases. It currently supports simple database refactoring and changes, although future plans include much more.
With SDRT, developers make database changes on their local development machine. As those changes get committed to the source control system and are distributed to other developers, changes are applied to those local developer databases, to the integration databases, staging databases, and even to live production databases. Changes may be applied through several methods, either via an Ant task, a command line program, or automatically during application or website startup. Further, the standard text file change log--an XML file containing SQL commands--may be reviewed and applied by a DBA.
The SDRT Migrator is the core system that enables easy development of database applications using an agile methodology. As changes are applied to the local database during development, those revisions are stored in an XML change log file. Each entry in the change log contains an “id” string and an “author” attribute. Those two attributes plus the name and location of the change file itself form a unique identifier for a particular change. When the migrator executes, it compares entries in a DatabaseChangeHistory table defined in the database. This table contains the “id”, “author”, and “file” identifier of all previous changes. If a change in the log file is not in the DatabaseChangeHistory table, the Migrator executes and records the change which will be skipped during future runs.
The change log files can be nested together via an INCLUDE tag. This is useful for breaking up changes by component, project, iteration, or whatever method works best for your project.
The motivation for creating the tool was further fueled by Refactoring Databases: Evolutionary Database Design and by finding that there were no tools available that really solved the problem of refactoring databases in development, and being able to apply those same changes through the live production environment deployment.