Restore Immich Database

Stop the Immich stack.

From Truenas, restore both the data and db folders using the existing sync task.

Start the Immich stack and allow the database to be created from scratch.

Stop the Immich server container.

Move the latest backup from /data/backups to /db

Log into the database container and run

cd /var/lib/postgresql/data
gunzip immich-db-backup-<latestfile>.sql.gz

psql -U postgres
DROP DATABASE immich;
createdb -U postgres -T template0 immich

psql -U postgres -d immich -f immich-db-backup-<latestfile>.sql.gz

Stop then start the Immich stack.