Class: PGTrunk::Operations::MaterializedViews::CreateMaterializedView

Inherits:
Base show all
Defined in:
lib/pg_trunk/operations/materialized_views/create_materialized_view.rb

Instance Method Summary collapse

Methods inherited from Base

#column

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



135
136
137
138
# File 'lib/pg_trunk/operations/materialized_views/create_materialized_view.rb', line 135

def invert
  irreversible!("if_not_exists: true") if if_not_exists
  DropMaterializedView.new(name: name)
end

#to_sql(_version) ⇒ Object



131
132
133
# File 'lib/pg_trunk/operations/materialized_views/create_materialized_view.rb', line 131

def to_sql(_version)
  [create_view, *alter_columns, *create_comment, register_view].join(" ")
end