mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-12-01 14:04:04 +03:00
Merge pull request #638 from jangeador/db-gzip
makes the database backups compressed. restores compressed backups
This commit is contained in:
commit
1d8bfe5554
|
@ -16,7 +16,7 @@ export PGPASSWORD=$POSTGRES_PASSWORD
|
||||||
echo "creating backup"
|
echo "creating backup"
|
||||||
echo "---------------"
|
echo "---------------"
|
||||||
|
|
||||||
FILENAME=backup_$(date +'%Y_%m_%dT%H_%M_%S').sql
|
FILENAME=backup_$(date +'%Y_%m_%dT%H_%M_%S').sql.gz
|
||||||
pg_dump -h postgres -U $POSTGRES_USER >> /backups/$FILENAME
|
pg_dump -h postgres -U $POSTGRES_USER | gzip > /backups/$FILENAME
|
||||||
|
|
||||||
echo "successfully created backup $FILENAME"
|
echo "successfully created backup $FILENAME"
|
||||||
|
|
|
@ -53,4 +53,4 @@ createdb -h postgres -U $POSTGRES_USER $POSTGRES_USER -O $POSTGRES_USER
|
||||||
|
|
||||||
# restore the database
|
# restore the database
|
||||||
echo "restoring database $POSTGRES_USER"
|
echo "restoring database $POSTGRES_USER"
|
||||||
psql -h postgres -U $POSTGRES_USER < $BACKUPFILE
|
gunzip -c $BACKUPFILE | psql -h postgres -U $POSTGRES_USER
|
||||||
|
|
Loading…
Reference in New Issue
Block a user