Class: PGTrunk::Operations::Rules::RenameRule
- Inherits:
-
Base
show all
- Defined in:
- lib/pg_trunk/operations/rules/rename_rule.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
58
59
60
|
# File 'lib/pg_trunk/operations/rules/rename_rule.rb', line 58
def invert
self.class.new(**to_h, name: new_name, to: name)
end
|
#to_sql(_version) ⇒ Object
51
52
53
54
55
56
|
# File 'lib/pg_trunk/operations/rules/rename_rule.rb', line 51
def to_sql(_version)
<<~SQL
ALTER RULE #{name.to_sql} ON #{table.to_sql}
RENAME TO #{new_name.to_sql};
SQL
end
|