Magic in software is not a good thing. It indicates either ignorance in the programmer or bugs in the software. Fortunately this was just a case of ignorance. Our problems were:
- Failure to use ActiveRecord's reset_column_information after a migration modifies a table (or before a model is used in a migration).
- Failure to periodically test migrations from scratch.
For details, see the migration documentation here.