Fix up monkey patching of ActiveRecord for migrations