Class: PGTrunk::Operations::Procedures::CreateProcedure

Inherits:
Base show all
Defined in:
lib/pg_trunk/operations/procedures/create_procedure.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



113
114
115
116
# File 'lib/pg_trunk/operations/procedures/create_procedure.rb', line 113

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

#to_sql(version) ⇒ Object



106
107
108
109
110
111
# File 'lib/pg_trunk/operations/procedures/create_procedure.rb', line 106

def to_sql(version)
  # Procedures were added to PostgreSQL in v11
  check_version!(version)

  [create_proc, *comment_proc, register_proc].join(" ")
end