2023-11-27

Goal

To create a local backup of the DIMMiN App's PostgreSQL database, then completely delete the app on Heroku.

Notes

Nuke it FR this time

Moved to my backups folder in cmd C:\Users\Billy\Desktop\DIMMiN\database_stuff\bkups

Backed up my postgres db: heroku pg:backups:capture -a dimmin

and downloaded it to my local heroku pg:backups:download -a dimmin

Then I created a new database in pgadmin called 20231127 and restored it to the db via the following command: pg_restore -h "localhost" -p "5432" -U "postgres" -d "20231127" -v "C:\Users\Billy\Desktop\DIMMiN\database_stuff\bkups\20231127"

Which successfully loaded the data into my database. I also backed up the blog posts in a csv file via the download feature of pgadmin to 20231127.csv via SELECT * FROM blog_post

Then I double-checked that I knew how to reset the database with a locally downloaded file via heroku config:get DATABASE_URL --app dimmin

which gives the following information: postgres://username:password@hostname:port/databasename

that was used in the following command: pg_restore --verbose --clean --no-acl --no-owner -h hostname -U username -d databasename -p C:\Users\Billy\Desktop\DIMMiN\database_stuff\bkups\20231127.dump

However for some reason this command wouldn't load / wouldn't execute. When I looked at the PostgreSQL Import Export Docs they recommended the following: pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump

So I'll have to make sure I know how to load in the dump file before I nuke the real app (heroku apps:destroy --app dimmin)

However I did nuke the test app: heroku apps:destroy --app dimmin-test

Results

  • Downloaded a most recent backup of the db (with formatting of blog posts corrected / Span tags removed)
  • Deleted the dimmin-test app
  • Tried to load in my local version of the postgresql db to the app to make sure I could, unfortunately I couldn't but that will be the goal for tomorrow

Next Time


Previous Note 2023-11-25 Next Note 2023-11-28