of schema modification commands and in many cases
the data can be migrated appropriately. However,
more complex schema modifications can cause data
migration problems.
In the current work, we have limited our interest
to the set of refactorings necessary to normalise a re-
lational database. For example, some of the refactor-
ings that we currently offer include:
• Convert an attribute to a table
• Convert a table to an attribute
• Extract dependent attributes to a new table
• Move attributes to an existing table
• Merge two tables
• Split a table
Each refactoring is defined in terms of two opera-
tions: (i) rollforward, which applies the refactoring to
an existing version, and (ii) rollback, which reverses
the refactoring process. Of course, some refactorings
lose data when they are applied and reversing them
does not reconstruct the data.
DBVersion is implemented in Ruby and refactor-
ing operations are simple Ruby plugins, which makes
it easy to add new refactorings. A refactoring can use
any sequence of SQL statements but it is important
that each rollforward operation has a corresponding
rollback operation. As figure 3 shows, the change
scripts are also written in Ruby which isolates the de-
veloper from database-specific SQL code embedded
in the plugins.
Database researchers have investigated similar
problems while studying how to map a given database
to an alternative schema, called Schema Mapping
(Yan et al., 2001). We are currently investigating the
best combination of schema modifications and refac-
torings for different development scenarios.
3.3 Database Releases
The final part of DBVersion is the release management
process. Unlike source control systems, in which ex-
tracting and compiling a version of the source code
produces a version of the software, database version-
ing is more akin to patching source code. A database
version control system must generate a patch to an
existing database.
Our current solution to this problem is to distribute
DBVersion with an application upgrade. When the
synchronise
command is executed, DBVersion will
identify the current version of the database instance
and generate the correct database script to upgrade the
database to the current version.
4 RELATED WORK
As discussed, there are a small number of software
products that help to manage database changes, for
example, LiquiBase (LiquiBase, 2008) and DBGhost
(Innovartis, 2008). None of these systems is widely
used. Compared to these systems, DBVersion’s main
contribution is to provide a closer integration with
source control systems and to support database devel-
opment practices that are similar to traditional soft-
ware development good practice.
There are three database research areas that deal
with database configuration issues (Roddick, 1995):
(i) schema modification, which allows changes to
existing database instances, (ii) schema evolution,
which supports changes the schema without losing
any data, and (iii) schema versioning, which allows
access to previous versions of the database schema
and data.
Although these techniques deal with changing the
database schema, they focus on managing change
within live databases rather than tracking change dur-
ing the development process. For example, the Mi-
crosoft Repository supports versioning in an SQL
Server database (Bergstraesser et al., 1999) with some
performance and storage costs. Similar approaches
have been applied in object database systems that
must persist data objects and also manage different
versions of those objects as the code changes (Sciore,
1994; db4objects Inc., 2008). However, most object
databases do not provide the developer with a history
of changes.
Temporal databases record a time dimension with
data and track (i) the real world time of an event and
(ii) the transaction time in the database (Conradi and
Westfechtel, 1998). Temporal databases do not han-
dle schema versioning or evolution and so do not pro-
vide support for database developers.
5 CONCLUSIONS
In this paper, we have described the problem of
database version control. We have distinguished
database version control from other database-oriented
methods such as schema modification, schema evolu-
tion and schema versioning by focusing on develop-
ing a method that integrates well with standard soft-
ware development processes and tools. The system
we have described, DBVersion, is an experimental
prototype that integrates with the Subversion source
control system. Close integration with existing source
control systems is one of the characteristics of DBVer-
sion.
ICSOFT 2008 - International Conference on Software and Data Technologies
86