[RAILS] Use PG Backups on Heroku

Introduction

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

environment

Rails 5.2.4.2 Vagrant + Ubuntu 16.04.5 LTS

What I tried

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

Use PG Backups on Heroku
Use perltidy on CentOS 8
Introducing Bugsnag on Heroku
Use mod_auth_cas on CentOS 8
Yay! I'm on Heroku!
Use bat on Centos.
Use mkdir on ubuntu
Use cpplapack on ubuntu
Error resolution on Heroku
Introduce Rails/Basic authentication on Heroku.
Use serial communication on Android
Use Swift Package on Playground
Use devise on multiple models
Use native code on Android
Use Docker Compose on Windows 10 Home
How to use Ruby on Rails
Deploy a war file on Heroku
Deploy Flask's Docker image on Heroku
Use Docker on your M1 Mac
Preparing to use electron-react-boilerplate on Ubuntu 20.4
Use the iostat command on CentOS 8
Use completion in Eclipse on mac
DB error on deploying with Heroku
Deploy Rails on Docker to heroku
Use Docker CE (official) on CentOS 8
Deploy your Rails app on Heroku