Before upgrade

Backup database! we're going from PostgreSQL 12 direcly to 15:

cd /path/to/misskey
docker-compose stop web # we won't want to get unsaved tooths
docker-compose exec db pg_dumpall -U misskey  > ../mk-dump.sql


git stash
git checkout master
git pull --no-rebase
git submodule update --init
git stash pop
docker-compose build
docker-compose stop && docker-compose up -d

Post upgrade

Nothing works, you need to reconstruct db from scratch:

docker-compose stop web
docker-compose stop db
sudo rm -rf db
docker-compose start db
mv ../mk-dump.sql db/
docker-compose exec db bash
psql -U misskey -d misskey < /var/lib/postgresql/data/mk-dump.sql

You also need to upgrade to new password encryption:

docker-compose stop db
sudo nano db/postgresql.conf # uncomment password_encryption = scram-sha-256

now you need to upgrade password. get your old password:

cat .config/docker.env
docker-compose start db
docker-compose exec db bash
psql -U misskey -d misskey

you can check before and after if password has been upgraded for new version with this command:

SELECT rolname, rolpassword ~ '^SCRAM-SHA-256\$' AS has_upgraded FROM pg_authid WHERE rolcanlogin;

now upgrade the password (you can reuse old password or change it to a new one)

{enter password}
{enter password again}

lastly, we start web, and let the upgrade finish itself

docker-compose start web