Class: Sequel::MigrationAlterTableReverser

Inherits:
BasicObject
Defined in:
lib/sequel/extensions/migration.rb

Overview

Handles reversing an alter_table block in a reversible migration.

Constant Summary

Constants inherited from BasicObject

BasicObject::KEEP_METHODS

Instance Method Summary collapse

Methods inherited from BasicObject

const_missing, remove_methods!

Constructor Details

#initializeMigrationAlterTableReverser

Returns a new instance of MigrationAlterTableReverser.



225
226
227
# File 'lib/sequel/extensions/migration.rb', line 225

def initialize
  @actions = []
end

Instance Method Details

#reverse(&block) ⇒ Object



229
230
231
232
233
# File 'lib/sequel/extensions/migration.rb', line 229

def reverse(&block)
  instance_eval(&block)
  actions = @actions.reverse
  Proc.new{actions.each{|a| send(*a)}}
end