Try using PG Backups, a command to back up your database on Heroku. Please refer to the official website for how to use it. https://devcenter.heroku.com/articles/heroku-postgres-backups
Rails 5.2.4.2 Vagrant + Ubuntu 16.04.5 LTS
Log in to Heroku.
$heroku login --interactive
Check the name of the application to be backed up.
$heroku apps
Specify the app name and back up manually.
$heroku pg:backups:capture --app app name
View the status to make sure you have a backup. For manually taken backups, the dump file is numbered with an ID starting with b, and the backup created by the scheduler seems to be numbered with an ID starting with a. Please note that the time stamps are displayed with a time difference of 9 hours.
$heroku pg:backups --app app name
Now, launch the web application and try updating the data appropriately. After this, restore and confirm that the data is restored.
Restore (restore) the backup file. Although b002 is specified, it will be the ID that was backed up. You will be prompted to enter the app name.
$heroku pg:backups:restore b002 --app app name
>Enter the app name
Launch the app from the web and check that the appropriately updated data has been restored.
Delete the created backup dump.
$heroku pg:backups:delete b002 --app app name
>Enter the app name
View the status again to verify that the backup dump with ID b002 has been deleted.
$heroku pg:backups --app app name
Log out of Heroku and exit.
$heroku logout
Recommended Posts