Database Schema Refactoring and Migrations

Ranked #95,447 in Computers & Electronics, #1,533,851 overall

A failed schema upgrade can ruin your day, week, or career

After developing an application upgrade with a partner site several states away, we were finally deploying.  And it wasn't going well.

The upgrade included several schema upgrades.  Those upgrades and the required data migration were scripted.  Good.  The development database schema didn't match the production schema.  Bad. Their answer?  "Run the script again and see if it works."  Bad, bad.  Two hours later, we had to roll back to the previous application.  They had backups.  Good.  They had no idea how to restore from their backups.  Oh... oh no, bad, bad, bad!

At that point I had been using ActiveRecord::Migrations for painless database upgrades for months, so i knew there was a better way, but a Ruby tool was a tough sell for this client.  Developers in all languages deserve an easy and repeatable way to upgrade their databases on deploy day, and this lens should put someone on the right track. 

Schema Refactoring Around the Web


Track and record database schema versions

My first search for information regarding schema upgrades
turned up this article. It still holds true, and it provides
the foundational knowledge required for implementing schema
migrations from a technical and administrative point of view.


Evolutionary Database Design

Matt Stevens interviews Scott Ambler concerning his work in the field of
database refactoring. Scott is a heavyweight in the field. Want proof?
Keep reading, he's the author two books listed below.

Books About Database Refactoring and Schema Migrations

These books go through the theory and mechanics of database schema migration in great detail. If you would like to avoid ad hoc migration plans, these books are well worth a read. Or maybe you simply learn better with a dead tree open on your desk.
Loading

Your Thoughts

How do you handle database schema refactoring and migration? Any horror stories to scare folks straight? Please, share them here!

  • Oct 4, 2010 @ 2:28 am | delete
    Great lens! you have put very nice information in this lens.Impeccably stated.Now our Best Website Designers team connect with your lens.More power!
  • apayah Sep 9, 2010 @ 11:58 am | delete
    digital electronic projects
  • rose08 Sep 15, 2008 @ 9:32 pm | delete
    Yes, data migration is sometimes a headache...check out my summer beach lens for relax...
  • semanticdb Sep 12, 2008 @ 1:41 am | delete
    Hi,

    Database schema refactoring was definitely a nightmare for me. But for the past 1 year I am using Poseidon Database its a Schemaless database which eliminates any kind of data modeling providing the fastest time to start, and needed peace of mind. It comes packed along with Brainwave Platform a complete development and deployment suite. http://www.brainwavelive.com/

    -SW
  • semanticdb Sep 12, 2008 @ 1:41 am | delete
    Hi,

    Database schema refactoring was definitely a nightmare for me. But for the past 1 year I am using Poseidon Database its a Schemaless database which eliminates any kind of data modeling providing the fastest time to start, and needed peace of mind. It comes packed along with Brainwave Platform a complete development and deployment suite. http://www.brainwavelive.com/

    -SW
  • Load More

by

timfreund

I'm a web application developer who works with Java, Python, and Ruby. I have personally used database migration tools with TurboGears and Ruby on Rail... more »

Feeling creative? Create a Lens!