I had a old script that worked for me on rails 4
ActiveRecord::Base.connection.tables.map { |t| "#{t} => " + ActiveRecord::Base.connection.execute("select count(*) from #{t}").first['count'] }
but this is not returning anything on a rails 5 project :(
This should work:
ActiveRecord::Base.connection.tables.map { |t| {t=> ActiveRecord::Base.connection.execute("select count(*) from #{t}")[0]} }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With