ActiveRecord finding existing table indexes

This works with MySQL, SQLite3, and Postgres:

ActiveRecord::Base.connection.tables.each do |table|
    puts ActiveRecord::Base.connection.indexes(table).inspect
end

But I think it only gives you the indexes you specifically created.

Also, to find out which adapter is in use:

ActiveRecord::Base.connection.class

Leave a Comment