Class: PGTrunk::Operations::Enums::DropEnum
- Inherits:
-
Base
show all
- Defined in:
- lib/pg_trunk/operations/enums/drop_enum.rb
Instance Method Summary
collapse
Methods inherited from Base
#value
#quote
#dump, #to_a, #to_opts, #to_ruby
#invert!, #irreversible!
#error_messages
#attributes, #initialize
Instance Method Details
#invert ⇒ Object
68
69
70
71
72
|
# File 'lib/pg_trunk/operations/enums/drop_enum.rb', line 68
def invert
irreversible!("if_exists: true") if if_exists
irreversible!("force: :cascade") if force == :cascade
CreateEnum.new(**to_h.except(:force))
end
|
#to_sql(_version) ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/pg_trunk/operations/enums/drop_enum.rb', line 60
def to_sql(_version)
sql = "DROP TYPE"
sql << " IF EXISTS" if if_exists
sql << " #{name.to_sql}"
sql << " CASCADE" if force == :cascade
sql << ";"
end
|