class ActiveRecord::Migration::CommandRecorder

def revert

# same effect as recorder.record(:rename_table, [:new, :old])
recorder.revert{ recorder.record(:rename_table, [:old, :new]) }

For example:
and in reverse order.
All commands recorded will end up being recorded reverted
While executing the given block, the recorded will be in reverting mode.
def revert
  @reverting = !@reverting
  previous = @commands
  @commands = []
  yield
ensure
  @commands = previous.concat(@commands.reverse)
  @reverting = !@reverting
end