module ActiveRecord::PGCollation::CommandRecorder
ActiveRecord::Migration::CommandRecorder is a class used by reversible migrations. It captures the forward migration commands and translates them into their inverse by way of some simple metaprogramming.
The Migrator class uses CommandRecorder
during the reverse migration instead of the connection object. Forward migration calls are translated to their inverse where possible, and then forwarded to the connetion. Irreversible migrations raise an exception.
Known schema statement methods are metaprogrammed into an inverse method like so:
create_table => invert_create_table
which returns:
[:drop_table, args.first]
Public Instance Methods
create_collation(*args, &block)
click to toggle source
# File lib/active_record/pg_collation/command_recorder.rb, line 25 def create_collation(*args, &block) record(:create_collation, args, &block) end
create_collation_from(*args, &block)
click to toggle source
# File lib/active_record/pg_collation/command_recorder.rb, line 29 def create_collation_from(*args, &block) record(:create_collation_from, args, &block) end
Private Instance Methods
invert_create_collation(args)
click to toggle source
# File lib/active_record/pg_collation/command_recorder.rb, line 35 def invert_create_collation(args) [:drop_collation, args] end