---
title: How To Back Up A Heroku Production Database To Staging
teaser: Backup a production Heroku Postgres database to a staging environment.
tags: web,heroku,postgresql
author: Dan Croak
published_on: 2011-08-18
---

Configure staging and production Git remotes to point to Heroku applications:

<kbd>
heroku git:remote -r staging -a your-staging-app
<br />
heroku git:remote -r production -a your-production-app
</kbd>

Install [Parity]. On MacOS, install via Homebrew:

[Parity]: https://github.com/thoughtbot/parity

<kbd>
brew tap thoughtbot/formulae
<br />
brew install parity
</kbd>

On other operating systems:

<kbd>gem install parity</kbd>

Create a database backup at any time:

<kbd>production backup</kbd>

Restore a production database backup into staging environment:

<kbd>staging restore production</kbd>

Restore a production database backup into local development environment:

<kbd>development restore production</kbd>
