Class: PGTrunk::Operations::Rules::CreateRule

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



118
119
120
121
# File 'lib/pg_trunk/operations/rules/create_rule.rb', line 118

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

#to_sql(_server_version) ⇒ Object



114
115
116
# File 'lib/pg_trunk/operations/rules/create_rule.rb', line 114

def to_sql(_server_version)
  [create_rule, *comment_rule, register_rule].join(" ")
end