teaminsight/undestroy — pull request #2 by tpett (2012-03-19 17:10:30+00:00)
Title: Migration statement

This adds automatic migrations to Undestroy. The `MigrationStatement` is where the bulk of the new logic lives. This class represents a migration method call (e.g. '`add_column`, '`create_table`', etc.). Each time a migration method is called it filters through the `MigrationStatement` class and conditionally runs an additional migration for the corresponding archive table (if one is configured). On `create_table` it is smart enough to tack extra columns onto the migration for archive tables (like the default `deleted_at` column).

There where a few other refactors that came about from this feature. One is the `Field` class. The `Field` instance is created for each extra field configured for an archive table. I decided to move to a class when I needed to start tracking the type so I could handle migrations. So now there is an `add_field` macro on the config class for defining a new `Field` and appending it to the defined fields for that configuration.

Check it out and let me know if you have any thoughts before we pull it in.