migration helpers

This adds a bunch of migration helpers for AR, mostly related to
foreign keying.