From my local terminal, I can use the following commands to do what I need to do:
heroku pgbackups:capture --expire
heroku pgbackups:restore charcoal --confirm max-kiosk
However, I want to do this from the controller of my rails app, when the Version model is udpated. Locally, I'm using:
env = Rails.env
%x{pg_dump -Fc master_bankkiosk_#{env} > database.dump}
puts "I'm dumping..."
%x{pg_restore --clean -d bankkiosk_#{env} database.dump}
puts "I'm restoring..."
I have come to understand that running heroku commands on the heroku server do not work (because the toolbelt is not installed there ?)
I've tried to use pg_dump command on heroku server as well. I've read a few SO questions that seems similar but the OP are satisfied with answers that include heroku pgbackups:blah, and I can't use that.