PostgreSQL Major Version Upgrade (v13 to v15)
Upgrading PostgreSQL from version 13 to 15 is a major version jump. Since PostgreSQL does not support in-place data directory upgrades, existing users must manually migrate their data using pg_dump.
Migration Steps
Backup Existing Data (Version 13): Before updating your compose file, ensure your containers are running and perform a dump of all databases.
bashdocker exec -it <project_name>-db-1 pg_dumpall -U postgres > full_dump.sqlStop and Remove Containers:
bashdocker compose downDelete Old Data Volume: PostgreSQL 15 cannot read data created by version 13. You must remove the existing volume (Warning: this deletes the old data directory).
bashdocker volume rm <project_name>_db-dataUpdate Image and Start (Version 15): Update your
overrides/compose.postgres.yaml(or pull the latest changes) and start the containers.bashdocker compose up -dRestore Data: Restore the dump into the new PostgreSQL 15 instance.
bashcat full_dump.sql | docker exec -i <project_name>-db-1 psql -U postgresVerify and Clean Up: Ensure your sites are working correctly with
bench migrateand then remove thefull_dump.sqlfile.bashdocker exec -it <project_name>-backend-1 bench --site all migrate
