I have a ruby on rails app deployed on heroku with a database and a follower database.
I typically do "heroku run rails console" to look around the data, and I'm wondering if there's a way that I can do it on the follower database so I don't accidentally write/delete things. I know this should be simple, but I couldn't seem to find documentation on it.
Thanks!
You can do this from your local console. Just fire it up:
rails console
Then you need the connection information for your follower database on heroku. You can retrieve this from https://postgres.heroku.com/databases/. Just click the relevant database and assign a hash with the following info:
follower_db = {:adapter => "postgresql",
:host => "myhost",
:username => "myuser",
:password => "mypass",
:database => "somedatabase"}
Now connect to this remote database from the console:
ActiveRecord::Base.establish_connection(follower_db)
Now any query you enter in the console will be run on this DB.
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