Skip to content

Instantly share code, notes, and snippets.


IanVaughan/db rows

Created Aug 19, 2020
What would you like to do?
get db row counts
tables = [ "users" ]
tables.each do |table|
count = ActiveRecord::Base.connection.execute("SELECT count(*) from #{table};")
puts "#{table}, #{count.entries.first["count"]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment