From 0aad23d31614a5d4893284cd3f8b59264a594a23 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Sat, 6 Apr 2019 14:59:59 -0300 Subject: [PATCH] Adiciona restaurar dump da producao --- sapl/legacy/scripts/restaura_da_producao.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 sapl/legacy/scripts/restaura_da_producao.sh diff --git a/sapl/legacy/scripts/restaura_da_producao.sh b/sapl/legacy/scripts/restaura_da_producao.sh new file mode 100755 index 000000000..e0524193c --- /dev/null +++ b/sapl/legacy/scripts/restaura_da_producao.sh @@ -0,0 +1,9 @@ +set -e # Exit immediately if a command exits with a non-zero status + +echo $HOME +echo "Database $1" +sudo -u postgres psql -c "drop DATABASE if exists $1" +sudo -u postgres psql -c "CREATE DATABASE $1 WITH OWNER = sapl ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'pt_BR.UTF-8' LC_CTYPE = 'pt_BR.UTF-8' CONNECTION LIMIT = -1 TEMPLATE template0;" + +sudo -u postgres pg_restore -d $1 -U postgres "$HOME/migracao_sapl/dumps_producao/$1.prod" +