project-cloud-sql-restore-db failed
I tried to download the database from prod to local via catladder and the command failed:
catladder $ project-cloud-sql-restore-db
? Source instance (connection string or 'local')? 🤔 prod:api
? target env? 🤔 local:api
? This will drop local/food2050 and replace it with prod/wea-food2050-prod-api. Continue? 🤔 Yes
Dumping file to /tmp/dump.nmVyvn
dump done
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: database "user" does not exist
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: database "user" does not exist
ChildProcessError: `
set -e
dumptmp=$(mktemp /tmp/dump.XXXXXX)
echo "Dumping file to $dumptmp"
pg_dump --dbname=postgres://postgres:GA9lmc5A2jmfbRmIbLDBXpIN1YQUrZY7@localhost:54399/wea-food2050-prod-api --no-owner --no-privileges > $dumptmp
echo "dump done"
PGPASSWORD=pass psql -p 5432 --host=localhost --user=user -q -c 'drop database "food2050" WITH (FORCE)' 1> /dev/null || true
PGPASSWORD=pass psql -p 5432 --host=localhost --user=user -q -c 'create database "food2050"' 1> /dev/null
echo "Restoring dump..."
PGPASSWORD=pass psql -p 5432 --host=localhost --user=user -q "food2050" < $dumptmp 1> /dev/null
echo "Clean up..."
set +e
rm $dumptmp
echo "
🐱 Done!"
` failed with code 2
at ChildProcess.<anonymous> (/Users/gaborraz/Development/panter/food-2050/node_modules/@catladder/cli/dist/bundles/cli/index.js:19:59077)
at ChildProcess.emit (node:events:517:28)
at ChildProcess.emit (node:domain:489:12)
at maybeClose (node:internal/child_process:1098:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:303:5)