Wednesday, August 6, 2008

Easy .NET database migrations

If you've ever written code that accesses a database, then you've experienced the issues brought on in trying to keep the database and code in sync. In their common and annoying form, it's when developer X does something like add a column in his local database, checks in the source code, and then developer Y does a checkout and her code breaks because it's looking for a column that doesn't exist in her local database. In their ugly form, the DBA forgets to add a column when the code goes to production and the deployment is bogged down while people scramble to find and fix the issue. Things like missing indexes can be the worst form of this problem, since the performance problems they can create can be very difficult to track down.

When Mr. Fowler wrote about his colleagues' evolutionary database design, things got better in the development world. I and many others soon hacked up some degree of database migration automation based on the principles outlined in that doc, and not too long later Rails popped up with a great implementation of them.

In the .NET world, it took a little longer for people to come up with their own flavors of this automation. When my homies and I wanted to standardize on a good solution, we found a few decent candidates, and landed on migratordotnet. It was pretty cool. Then my smarty pants colleague Geoff took it and made it production quality. He added a bunch more functionality and did some major refactoring.

Once you start using it, you'll never want to go back. Someday you'll wonder how we ever managed without tools like this in our belts.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home