Class: PGTrunk::Operations::CompositeTypes::DropCompositeType
- Inherits:
-
Base
show all
- Defined in:
- lib/pg_trunk/operations/composite_types/drop_composite_type.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
66
67
68
69
70
|
# File 'lib/pg_trunk/operations/composite_types/drop_composite_type.rb', line 66
def invert
irreversible!("if_exists: true") if if_exists
irreversible!("force: :cascade") if force == :cascade
CreateCompositeType.new(**to_h.except(:force, :if_exists))
end
|
#to_sql(_version) ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/pg_trunk/operations/composite_types/drop_composite_type.rb', line 58
def to_sql(_version)
sql = "DROP TYPE"
sql << " IF EXISTS" if if_exists
sql << " #{name.to_sql}"
sql << " CASCADE" if force == :cascade
sql << ";"
end
|