class PGTrunk::Operations::ForeignKeys::DropForeignKey

@private

Public Instance Methods

invert() click to toggle source
# File lib/pg_trunk/operations/foreign_keys/drop_foreign_key.rb, line 80
def invert
  irreversible!("if_exists: true") if if_exists
  AddForeignKey.new(**to_h)
end
to_sql(_version) click to toggle source
# File lib/pg_trunk/operations/foreign_keys/drop_foreign_key.rb, line 74
def to_sql(_version)
  sql = "ALTER TABLE #{table.to_sql} DROP CONSTRAINT"
  sql << " IF EXISTS" if if_exists
  sql << " #{name.lean.inspect};"
end