pg_dump mismatch

found out about this shorter one : fly ssh sftp get "dump.sql" -a app_name

then trying to setup a simple bash script file :

database_uri=$(fly ssh console -a app_name -C "printenv DATABASE_URL")
fly ssh console -a app_db -C "pg_dump $database_uri > dump.sql"
fly ssh sftp get "dump.sql" -a app_name

dropdb local_db && \
  createdb local_db && \
  psql -U local_username -d local_db -f dump.sql

With no success - the $database_uri in the second line is not readable on the remote instance…I might lack of basic bash knowledge. Such a simple script could work somehow ?

1 Like