Advertisement
Guest User

Untitled

a guest
Jan 20th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. require 'active_record'
  2.  
  3. blacklist = {
  4. icis_production: [ 'patient_versions', 'patients' ],
  5. snowflake_production: [ 'persons' ]
  6. }
  7.  
  8. blacklist.each_pair do |database, blacklisted_tables|
  9. spec = {
  10. adapter: :postgresql,
  11. database: database,
  12. username: ENV['GM_USERNAME'],
  13. password: ENV['GM_PASSWORD']
  14. }
  15.  
  16. ActiveRecord::Base.establish_connection(spec)
  17.  
  18. puts "Tables for #{database} without blacklisted tables:"
  19. tables_wo_blacklist = ActiveRecord::Base.connection.tables - blacklisted_tables
  20.  
  21. puts " #{tables_wo_blacklist.sort.join(', ')}"
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement