I'm trying to write a bash script that dumps data from remote db and restores it inside a local docker container. The problem is there are like 90 tables with a lot of foreign keys but the data dump does not seem to care about the ordering of inserts. What can I do about this so it would actually insert all rows?
This is how I'm dumping things currently
#Dumps roles
pg_dumpall --roles-only -U $user -h $db_url -p $port --clean --file=roles.dump
#Dumps schema
pg_dump --clean -s --host $db_url --port $port --user $user $db_to_dump > backup-schema.dump
#Dumps data
pg_dump --column-inserts --host $db_url --port $port --user $user $db_to_dump -n $schema_to_dump > data.dump