Skip to content

Instantly share code, notes, and snippets.

@ironheart122
Forked from jgillman/restore.sh
Created January 5, 2021 09:03
Show Gist options
  • Save ironheart122/612f3ab119349f899e1b9927793b3061 to your computer and use it in GitHub Desktop.
Save ironheart122/612f3ab119349f899e1b9927793b3061 to your computer and use it in GitHub Desktop.

Revisions

  1. @jgillman jgillman renamed this gist May 7, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @jgillman jgillman revised this gist May 7, 2016. No changes.
  3. @jgillman jgillman created this gist May 7, 2016.
    10 changes: 10 additions & 0 deletions restore
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # Assumes the database container is named 'db'

    DOCKER_DB_NAME="$(docker-compose ps -q db)"
    DB_HOSTNAME=db
    DB_USER=postgres
    LOCAL_DUMP_PATH="path/to/local.dump"

    docker-compose up -d db
    docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
    docker-compose stop db