PuzzleTechHub / myus

A public hassle free puzzlehunt hosting tool
https://www.puzzlehuntmy.us/
MIT License
1 stars 9 forks source link

Convert from heroku and Heroku-Postgres to Supabase #60

Open TheOriginalSoni opened 3 months ago

TheOriginalSoni commented 3 months ago

Update with new DB

TheOriginalSoni commented 3 months ago

Steps to convert from Heroku Postgres to Supabase

#Download local backup of Heroku DB
heroku pg:backups:capture -a my-heroku-app
heroku pg:backups:download -a my-heroku-app

#Make DB locally on Postgres
sudo -u postgres psql
create database new_db_name;

#Convert local backup into local postgres DB
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d new_db_name -U postgres latest.dump

#Convert local DB to sql file dump
pg_dump -U <local-db-username> -h localhost -d my-local-db > localdb.sql

#Then make a new project on Supabase
#Follow usual steps for it, wait for Database to be made. Once completed, go to Connect - PSQL and copy the string

#Upload local sql file dump to Supabase
#Edit the PSQL code from above to add the relevant additional parameters
psql -h <supabase-db-host>.supabase.com -p <supabase-db-port> -U postgres.<supabase-db-username> -d <supabase-db-name> -f localdb.sql