Module: ActiveRecord::PGExtensions::CommandRecorder

Defined in:
lib/active_record/pg_extensions/command_recorder.rb

Overview

adds support for reverting migration methods added by this gem

Instance Method Summary collapse

Instance Method Details

#invert_rename_constraint(args) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/active_record/pg_extensions/command_recorder.rb', line 11

def invert_rename_constraint(args)
  table_name, old_name, new_name, options = args
  options ||= {}
  # flag the trailing hash as keyword arguments so it's replayed as
  # `rename_constraint(..., if_exists:)` rather than a positional hash
  [:rename_constraint, [table_name, new_name, old_name, Hash.ruby2_keywords_hash(options)]]
end

#rename_constraint(table_name, old_name, new_name, **options) ⇒ Object



7
8
9
# File 'lib/active_record/pg_extensions/command_recorder.rb', line 7

def rename_constraint(table_name, old_name, new_name, **options)
  record(:rename_constraint, [table_name, old_name, new_name, options])
end