module SchemaPlus::Indexes::ActiveRecord::ConnectionAdapters::IndexDefinition

Attributes

orders[RW]

Public Instance Methods

==(other) click to toggle source

tests if the corresponding indexes would be the same

# File lib/schema_plus/indexes/active_record/connection_adapters/index_definition.rb, line 25
def ==(other)
  return false if other.nil?
  return false unless self.name == other.name
  return false unless Array.wrap(self.columns).collect(&:to_s).sort == Array.wrap(other.columns).collect(&:to_s).sort
  return false unless !!self.unique == !!other.unique
  return false if (self.lengths || {}) != (other.lengths || {}) # treat nil same as empty hash
  return false unless self.where == other.where
  return false unless (self.using||:btree) == (other.using||:btree)
  true
end