So the way I have been backing up Postgres is with:
pg_dumpall -U eox-dev -h localhost --clean --file=/home/backups/postgres.sql
I want to make sure I have a production ready backup that has functions, relationships, triggers, in addition to tables and data.
I'm trying to restore it now in a Kubernetes cluster into a database with a different name
staging_db, but get
FATAL: database "prod_db" does not exist. I'm trying to restore it to
staging_db so that makes sense. One of the first lines in the
.sql does declare
CREATE DATABASE prod_db. I'm not about the edit the
.sql. If I have to do that, I'm doing something wrong.
What is the correct way of making this backup?