Class: PGTrunk::Operations::Triggers::CreateTrigger

Inherits:
Base show all
Defined in:
lib/pg_trunk/operations/triggers/create_trigger.rb

Instance Method Summary collapse

Methods inherited from Base

#<=>

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



163
164
165
166
# File 'lib/pg_trunk/operations/triggers/create_trigger.rb', line 163

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

#to_sql(version) ⇒ Object



155
156
157
158
159
160
161
# File 'lib/pg_trunk/operations/triggers/create_trigger.rb', line 155

def to_sql(version)
  [
    create_trigger(version),
    *create_comment,
    register_trigger,
  ].join(" ")
end