Help upgrading postgresql used for gitea

I’m using a PostgreSQL database with gitea running in docker as per https://docs.gitea.com.

I’m having trouble finding documentation in any web searches on how to upgrade the database version being used. I have attempted to increase my postgresql version number in my docker-compose.yml, but it always breaks gitea. I’ve been successful testing upgrading gitea itself this way, but not with upgrading postgresql.

Any help or suggestions is greatly appreciated.

Postgres containers cannot be updated as easily as other containers. At least not if the major version changes. To update Postgres to a new major version, you must first make a dump of the DB, then start the new Postgres version and then import the dump of the old version. It is best to create a new volume for the new DB container. Then you still have the old one available as a backup / fallback solution.

This has less to do with Gitea. Gitea runs smoothly with the current Postgres version 16.