Last active
January 2, 2024 07:39
-
-
Save mshRoR/af1ea5fa2a71d02aefecd6a2fb7e9b68 to your computer and use it in GitHub Desktop.
upgrade-postgresql-with-docker-compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spin up our new (empty) database | |
docker compose up -d db_postgres_151 | |
# login to postgres | |
$ psql -U postgres | |
$ CREATE DATABASE database_name | |
# dump our existing database | |
docker compose exec -it db_postgres_146 /bin/bash -c 'pg_dumpall -U $POSTGRES_USER > /backup/20230127.sql' | |
# restore that dump in our new database | |
docker compose exec -it db_postgres_151 /bin/bash -c 'psql -d $POSTGRES_DB -U $POSTGRES_USER < /backup/20230127.sql' | |
source: https://eelkevdbos.medium.com/upgrade-postgresql-with-docker-compose-99d995e464 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Upgrade PostgreSQL with Docker Compose
Step-1:
Step-2:
Step-3:
Final Result: