mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Generalise db remote backup script, add restore script
This commit is contained in:
7
script/backup.sh
Executable file
7
script/backup.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage: script/backup.sh [ofn-staging1|ofn-staging2|ofn-prod]
|
||||
|
||||
set -e
|
||||
|
||||
ssh $1 "pg_dump -h localhost -U openfoodweb openfoodweb_production |gzip" > db/backup/$1-`date +%Y%m%d`.sql.gz
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
ssh ofn-prod "pg_dump -h localhost -U openfoodweb openfoodweb_production |gzip" > db/backup/ofn-prod-`date +%Y%m%d`.sql.gz
|
||||
9
script/restore.sh
Executable file
9
script/restore.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Usage: script/restore.sh [file.sql.gz]
|
||||
|
||||
set -e
|
||||
|
||||
echo "drop database open_food_network_dev" | psql -h localhost -U ofn open_food_network_test
|
||||
echo "create database open_food_network_dev" | psql -h localhost -U ofn open_food_network_test
|
||||
zcat $1 |psql -h localhost -U ofn open_food_network_dev
|
||||
Reference in New Issue
Block a user