Class: PGTrunk::Operations::Functions::RenameFunction

Inherits:
Base show all
Defined in:
lib/pg_trunk/operations/functions/rename_function.rb

Instance Method Summary collapse

Methods included from PGTrunk::Operation::SQLHelpers

#quote

Methods included from PGTrunk::Operation::RubyHelpers

#dump, #to_a, #to_opts, #to_ruby

Methods included from PGTrunk::Operation::Inversion

#invert!, #irreversible!

Methods included from PGTrunk::Operation::Validations

#error_messages

Methods included from PGTrunk::Operation::Attributes

#attributes, #initialize

Instance Method Details

#invertObject



44
45
46
47
# File 'lib/pg_trunk/operations/functions/rename_function.rb', line 44

def invert
  q_new_name = "#{new_name.schema}.#{new_name.routine}(#{name.args}) #{name.returns}"
  self.class.new(**to_h, name: q_new_name.strip, to: name)
end

#to_sql(_version) ⇒ Object



40
41
42
# File 'lib/pg_trunk/operations/functions/rename_function.rb', line 40

def to_sql(_version)
  [*change_schema, *change_name].join(" ")
end