Skip to content

Instantly share code, notes, and snippets.

View davygora's full-sized avatar
💎
^_^

Eugene davygora

💎
^_^
  • Kyiv, Ukraine
View GitHub Profile
@davygora
davygora / list_indexes_in_rails_console.rb
Created September 10, 2018 12:36
Get list of all indexes in rails console.
# rails console
ActiveRecord::Base.connection.tables.each do |table|
indexes = ActiveRecord::Base.connection.indexes(table)
if indexes.length > 0
puts "====> #{table} <===="
indexes.each do |index|
puts "----> #{index.name}"
end
puts "====> #{table} <===="