Skip to content

Commit

Permalink
Initialize the database before running restore
Browse files Browse the repository at this point in the history
  • Loading branch information
slumber authored and Deniallugo committed Jul 7, 2021
1 parent 1efa0a7 commit e515338
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docker/data-restore/data-restore-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export $(cat $ZKSYNC_HOME/etc/env/docker.env | sed 's/#.*//g' | xargs)

# Wait for the database to be ready.
until pg_isready -d $DATABASE_URL; do
sleep 1
sleep 1
done

if [[ -z $COMMAND || -z $NETWORK || -z $WEB3_URL ]]
Expand Down Expand Up @@ -49,8 +49,9 @@ then
[ -f /pg_restore/$PG_DUMP ] || { echo "$PG_DUMP not found" ; exit 1 ; }

zk db drop || true
zk db basic-setup
echo "Applying $PG_DUMP"
pg_restore -j 8 -d $DATABASE_URL /pg_restore/$PG_DUMP
pg_restore -j 8 -d $DATABASE_URL --clean --if-exists /pg_restore/$PG_DUMP
fi

CONFIG_FILE="/usr/src/configs/${NETWORK}.json"
Expand Down

0 comments on commit e515338

Please sign in to comment.