Class: PGTrunk::Operations::Functions::CreateFunction

Inherits:
Base show all
Defined in:
lib/pg_trunk/operations/functions/create_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



145
146
147
148
# File 'lib/pg_trunk/operations/functions/create_function.rb', line 145

def invert
  irreversible!("replace_existing: true") if replace_existing
  DropFunction.new(**to_h)
end

#to_sql(version) ⇒ Object



137
138
139
140
141
142
143
# File 'lib/pg_trunk/operations/functions/create_function.rb', line 137

def to_sql(version)
  [
    create_function,
    *comment_function,
    register_function(version),
  ].join(" ")
end