I have a MySQL database that runs for some time now with many changes on it. Lately I looked over it and I noticed that in some cases I have doubled the index on the same fi
indexes = ActiveRecord::Base.connection.execute("SHOW INDEX FROM tablename")
indexes.each do |index|
ActiveRecord::Base.connection.execute("ALTER TABLE tablename DROP INDEX #{index[2]};")
end