class ActiveSchema::Index::Pruner

Public Class Methods

new(connection, table_name, indexes) click to toggle source
# File lib/active_schema/index.rb, line 33
def initialize connection, table_name, indexes
  @connection, @table_name, @indexes = \
    connection, table_name, indexes

  existing = @connection.indexes(@table_name).map(&:name)
  specified = @indexes.map {|c| @connection.index_name(@table_name, c)}

  p [existing, specified]

  (existing - specified).each do |index|
    @connection.remove_index(@table_name, index)
  end

end