Here’s how the story ends:
The synapse database was simply empty because it couldn’t be restored—the restore script failed before reaching that step.
So here are the steps to resolve this restoration issue if anyone else finds themselves in the same situation: (thanks a lot @otm33 for your help and @Lapineige for further details)
-
Check that you have enough available disk space

-
Restore the backup using the
--no-remove-on-failureflag:
yunohost backup restore synapse-pre-upgrade1 --no-remove-on-failure -
Make a copy of your synapse backup (or rename it) in order to prevent it from being removed in the next step (you’ll need it in step 8)
-
Force the application upgrade:
yunohost app upgrade synapse -b --force -
Stop Synapse service
sudo systemctl stop synapse -
Drop Synapse database
sudo -u postgres psql -c "DROP DATABASE synapse;" -
Recreate it with correct encoding:
sudo -u postgres psql -c "CREATE DATABASE synapse OWNER synapse ENCODING 'UTF8' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;" -
Extract the database dump from synapse backup:
tar -xf /home/yunohost.backup/archives/SYNAPSE_ARCHIVE.tar -C /tmp/synapse-backup apps/synapse/backup/dump.sql -
Restore the db dump into postgresql:
sudo -u postgres psql -d synapse < /tmp/synapse-backup/apps/synapse/backup/dump.sql -
Start Synapse service
sudo systemctl start synapse
Note that all your devices will need to be verified again. I didn’t find a way to avoid that (but there might be a trick to doing it?)