Class: PGTrunk::Operations::Sequences::CreateSequence

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



141
142
143
144
# File 'lib/pg_trunk/operations/sequences/create_sequence.rb', line 141

def invert
  irreversible!("if_not_exists: true") if if_not_exists
  DropSequence.new(**to_h.except(:if_not_exists))
end

#to_sql(_server_version) ⇒ Object



137
138
139
# File 'lib/pg_trunk/operations/sequences/create_sequence.rb', line 137

def to_sql(_server_version)
  [create_sequence, *comment_sequence, register_sequence].join(" ")
end