Reversible migrations

Merge in this feature to the 0.2.x development branch.