bin-extra/copy-polymny-db

8 lines
468 B
Plaintext
Raw Permalink Normal View History

2022-06-21 13:02:24 +01:00
#!/usr/bin/env bash
scp mnemosyne:/var/backups/postgres/polymny-2.pg_dump.gz /tmp/
gunzip /tmp/polymny-2.pg_dump.gz
chmod 0666 /tmp/polymny-2.pg_dump
# sudo su -c '/usr/lib/postgresql/12/bin/dropdb polymny ; /usr/lib/postgresql/12/bin/createdb polymny -O polymny; /usr/lib/postgresql/12/bin/pg_restore -d polymny /tmp/polymny.pg_dump' postgres
sudo su -c 'dropdb polymny-2 ; createdb polymny-2 -O polymny; pg_restore -d polymny-2 /tmp/polymny-2.pg_dump' postgres