I had asked an earlier question which did not get any replies.
Basically I get an error invalid database url
when I try to do heroku db:push
Here's how to do it in a Ruby script:
# Connect to database.
uri = URI.parse(ENV['DATABASE_URL'])
postgres = PG.connect(uri.hostname, uri.port, nil, nil, uri.path[1..-1], uri.user, uri.password)
# List all tables.
tables = postgres.exec('SELECT * FROM pg_catalog.pg_tables')
tables.num_tuples.times do |i|
p tables[i]
end