Class: Sequel::MigrationAlterTableReverser

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

Overview

Handles reversing an alter_table block in a reversible migration.

Instance Method Summary collapse

Methods inherited from BasicObject

const_missing

Constructor Details

#initializeMigrationAlterTableReverser


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

def initialize
  @actions = []
end

Instance Method Details

#reverse(&block) ⇒ Object


233
234
235
236
237
238
# File 'lib/sequel/extensions/migration.rb', line 233

def reverse(&block)
  instance_exec(&block)
  actions = @actions.reverse
  # Allow calling private methods as the reversing methods are private
  Proc.new{actions.each{|a| send(*a)}}
end