Class: PGTrunk::Operations::Sequences::RenameSequence

Inherits:
Base show all
Defined in:
lib/pg_trunk/operations/sequences/rename_sequence.rb

Instance Method Summary collapse

Methods inherited from Base

#owned_by

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



40
41
42
43
# File 'lib/pg_trunk/operations/sequences/rename_sequence.rb', line 40

def invert
  irreversible!("if_exists: true") if if_exists
  self.class.new(**to_h, name: new_name, to: name)
end

#to_sql(_version) ⇒ Object



36
37
38
# File 'lib/pg_trunk/operations/sequences/rename_sequence.rb', line 36

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