Class: PGTrunk::Operations::CheckConstraints::DropCheckConstraint
- Inherits:
-
Base
show all
- Defined in:
- lib/pg_trunk/operations/check_constraints/drop_check_constraint.rb
Instance Method Summary
collapse
Methods inherited from Base
#<=>
#quote
#dump, #to_a, #to_opts, #to_ruby
#invert!, #irreversible!
#error_messages
#attributes, #initialize
Instance Method Details
#invert ⇒ Object
66
67
68
69
|
# File 'lib/pg_trunk/operations/check_constraints/drop_check_constraint.rb', line 66
def invert
irreversible!("if_exists: true") if if_exists
AddCheckConstraint.new(**to_h)
end
|
#to_sql(_version) ⇒ Object
60
61
62
63
64
|
# File 'lib/pg_trunk/operations/check_constraints/drop_check_constraint.rb', line 60
def to_sql(_version)
sql = "ALTER TABLE #{table.to_sql} DROP CONSTRAINT"
sql << " IF EXISTS" if if_exists
sql << " #{name.name.inspect};"
end
|