Skip to content

Commit

Permalink
feat(makefile): add restore-from commands for pg_restore
Browse files Browse the repository at this point in the history
  • Loading branch information
imarquezc committed Dec 20, 2019
1 parent 2e75ff5 commit 977e3d6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/potassium/assets/Makefile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,19 @@ services-logs:
services-port:
@set -o pipefail; \
docker-compose $(DOCKER_COMPOSE_ARGS) port ${SERVICE} ${PORT} 2> /dev/null | cut -d':' -f2 || echo ${PORT}

backup-staging:
staging pg:backups:capture

backup-production:
production pg:backups:capture

restore-from-staging:
staging pg:backups:download
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -p $(shell make services-port SERVICE=postgresql PORT=5432) -d $(PROJECT)_development latest.dump
@rm latest.dump

restore-from-production:
production pg:backups:download
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -p $(shell make services-port SERVICE=postgresql PORT=5432) -d $(PROJECT)_development latest.dump
@rm latest.dump

0 comments on commit 977e3d6

Please sign in to comment.