I’m working to upgrade our environment and would like to use a pg_dump Postgres db backup file to restore to a separate Render instance - in this case our dev environment.
I’m using this command to backup: pg_dump -d $SOURCE_RENDER_PG_EXTERNAL_CONNECTION_STRING > ${BACKUP_FILENAME}
And would like to use a similar command to restore. Something like: psql $DESTINATION_RENDER_PG_EXTERNAL_CONNECTION_STRING -f $BACKUP_FILENAME
However, I’m running into issues of conflicting usernames, database names etc. I’m unable to figure out how to avoid this issue or drop the database prior to restoring etc.
Thanks so much, this is a huge help. Would I run the restore command from the shell on the running instance, or in a script during the build? If so, would I run it after the migrations? I appreciate the help.
The only thing I need to figure out is how to run this script as part of my dev build (when needed). Currently I’m using the External Connection. If anyone can recommend how I would modify the restore script to allow for the Internal database connection, that would be very much appreciated!