Class: PGTrunk::Operations::Functions::DropFunction
- Inherits:
-
Base
show all
- Defined in:
- lib/pg_trunk/operations/functions/drop_function.rb
Instance Method Summary
collapse
#quote
#dump, #to_a, #to_opts, #to_ruby
#invert!, #irreversible!
#error_messages
#attributes, #initialize
Instance Method Details
#invert ⇒ Object
95
96
97
98
99
|
# File 'lib/pg_trunk/operations/functions/drop_function.rb', line 95
def invert
irreversible!("if_exists: true") if if_exists
irreversible!("force: :cascade") if force == :cascade
CreateFunction.new(**to_h.except(:force))
end
|
#to_sql(_version) ⇒ Object
87
88
89
90
91
92
93
|
# File 'lib/pg_trunk/operations/functions/drop_function.rb', line 87
def to_sql(_version)
sql = "DROP FUNCTION"
sql << " IF EXISTS" if if_exists
sql << " #{name.to_sql}"
sql << " CASCADE" if force == :cascade
sql << ";"
end
|