Wrap Migration in Transaction

Hello Caleb,

I've also tried doing:
ActiveRecord::Base.transation do
  %x[rake migrate]

But this, obviously, doesn't work since %x[rake migrate]
spanws a new process outside of the scope of the

Any ideas?

To invoke a Rake task in a migration, you can do :

def self.up

I have tried with : Rake::Task['stats'].invoke and it works.
However, it can be dangerous, what will happen with a
Rake::Task['db:migrate'] ? infinite loop ? :slight_smile: it could be a mess...
I think a rake db task would work, but you have to be careful.

     -- Jean-François.