Class: PGTrunk::Operations::ForeignKeys::AddForeignKey
- Inherits:
-
Base
show all
- Defined in:
- lib/pg_trunk/operations/foreign_keys/add_foreign_key.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
143
144
145
146
|
# File 'lib/pg_trunk/operations/foreign_keys/add_foreign_key.rb', line 143
def invert
irreversible!("if_not_exists: true") if if_not_exists
DropForeignKey.new(**to_h)
end
|
#to_sql(_version) ⇒ Object
134
135
136
137
138
139
140
141
|
# File 'lib/pg_trunk/operations/foreign_keys/add_foreign_key.rb', line 134
def to_sql(_version)
return if if_not_exists && added?
[add_constraint, , register_fk].join(" ")
end
|