Guest User

Untitled

a guest
Dec 9th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. c = ActiveRecord::Base.connection
  2. c.tables.collect do |t|
  3. columns = c.columns(t).collect(&:name).select {|x| x.ends_with?("_id" || x.ends_with("_type"))}
  4. indexed_columns = c.indexes(t).collect(&:columns).flatten.uniq
  5. unindexed = columns - indexed_columns
  6. unless unindexed.empty?
  7. puts "#{t}: #{unindexed.join(", ")}"
  8. end
  9. end
Add Comment
Please, Sign In to add comment