Class: PGTrunk::Operations::CheckConstraints::RenameCheckConstraint
- Inherits:
-
Base
show all
- Defined in:
- lib/pg_trunk/operations/check_constraints/rename_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
59
60
61
|
# File 'lib/pg_trunk/operations/check_constraints/rename_check_constraint.rb', line 59
def invert
self.class.new(**to_h, name: new_name, to: name)
end
|
#to_sql(_version) ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/pg_trunk/operations/check_constraints/rename_check_constraint.rb', line 51
def to_sql(_version)
" ALTER TABLE \#{table.to_sql}\n RENAME CONSTRAINT \#{name.name.inspect}\n TO \#{new_name.name.inspect};\n SQL\nend\n".squish
|