mirror of
https://github.com/matter-labs/ansible-en-role.git
synced 2025-12-06 10:59:56 +00:00
feat!: create ansible EN role (#2)
This commit is contained in:
13
templates/restore_dump.sh.j2
Normal file
13
templates/restore_dump.sh.j2
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
{% if force_pg_restore %}
|
||||
pg_restore --clean --exit-on-error -j $(nproc --all) -d postgres -U $POSTGRES_USER --no-owner --no-privileges --disable-triggers --create /pg_backups/external_node_latest.pgdump
|
||||
{% else %}
|
||||
if psql -U $POSTGRES_USER -d postgres -lqt | cut -d \| -f 1 | grep -qw "{{ database_name }}"; then
|
||||
echo "Database already exists"
|
||||
else
|
||||
echo "Database does not exist"
|
||||
pg_restore --exit-on-error -j $(nproc --all) -d postgres -U $POSTGRES_USER --no-owner --no-privileges --disable-triggers --create /pg_backups/external_node_latest.pgdump
|
||||
fi
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user