Last active
May 9, 2016 19:56
-
-
Save mecampbellsoup/eb398e8ab158a74b1ff9a64f021ce79a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # to be run from within a sandbox and production rails console instance | |
| table_names = %w( | |
| ach_file_transitions | |
| ach_file_deliveries | |
| ach_file_archives | |
| ach_files | |
| delivery_targets | |
| batches | |
| entries | |
| token_credentials | |
| webhooks | |
| ) | |
| # count the total # of records in each of the tables in table_names | |
| table_names.each do |name| | |
| puts "====================" | |
| puts "====================" | |
| puts "====================" | |
| puts "Counting records for table: #{name}..." | |
| sql = "select count(*) from public.#{name}" | |
| conn = ActiveRecord::Base.connection | |
| count = conn.execute(sql).values[0][0] | |
| puts "There are: #{count} total records in the #{name} table." | |
| puts "====================" | |
| puts "====================" | |
| puts "====================" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment