Class: PGTrunk::Operations::MaterializedViews::DropMaterializedView
- Inherits:
-
Base
show all
- Defined in:
- lib/pg_trunk/operations/materialized_views/drop_materialized_view.rb
Instance Method Summary
collapse
Methods inherited from Base
#column
#quote
#dump, #to_a, #to_opts, #to_ruby
#invert!, #irreversible!
#error_messages
#attributes, #initialize
Instance Method Details
#invert ⇒ Object
77
78
79
80
81
|
# File 'lib/pg_trunk/operations/materialized_views/drop_materialized_view.rb', line 77
def invert
irreversible!("if_exists: true") if if_exists
irreversible!("force: :cascade") if force == :cascade
CreateMaterializedView.new(**to_h.except(:force))
end
|
#to_sql(_version) ⇒ Object
69
70
71
72
73
74
75
|
# File 'lib/pg_trunk/operations/materialized_views/drop_materialized_view.rb', line 69
def to_sql(_version)
sql = "DROP MATERIALIZED VIEW"
sql << " IF EXISTS" if if_exists
sql << " #{name.to_sql}"
sql << " CASCADE" if force == :cascade
sql << ";"
end
|