module SchemaPlus::Indexes::ActiveRecord::ConnectionAdapters::IndexDefinition
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 46 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 if self.lengths.is_a?(Hash) or other.lengths.is_a?(Hash) return false if (self.lengths || {}) != (other.lengths || {}) # treat nil same as empty hash else return false if Array.wrap(self.lengths).compact.sort != Array.wrap(other.lengths).compact.sort end return false unless self.where == other.where return false unless (self.using||:btree) == (other.using||:btree) true end