When a movie or a show moves to another folder, Jellyfin deletes the old item and keeps its watched marks, favorites and resume points aside, on a placeholder. It is meant to give them back to the new item, and sometimes it does not, so everything shows as unwatched. The data usually stays in the database, as long as nothing has removed it since. This page finds it, matches it to your current items with the same keys the server uses, and gives you a SQL file that puts it back.
/var/lib/jellyfin/data/jellyfin.db on Linux, /config/data/jellyfin.db in Docker, or C:\ProgramData\Jellyfin\Server\data\jellyfin.db on Windows.jellyfin.db somewhere safe, and keep that copy. If jellyfin.db-wal or jellyfin.db-shm sit next to it, copy them too.
No warranty: you run this file yourself, on a database you have copied first. If anything goes wrong, put your copy back.
With Jellyfin still stopped, run the file as the user the server runs as, so the database keeps its owner, for example sudo -u jellyfin sqlite3 -bail /var/lib/jellyfin/data/jellyfin.db < watchrelink.sql (with Docker, on the file in the host folder mounted as /config), then start Jellyfin. Each line only moves a row off the placeholder, and only if the item has no row of its own for the same person and key, so running it twice does nothing more. If anything looks wrong, stop Jellyfin, put your copy back, and remove any leftover jellyfin.db-wal or jellyfin.db-shm.
Possible later tool: copy marks from an older backup (3 USD, one time, not built).
It would copy watched marks and favorites from an older copy of the database, for example one from before an upgrade, into the current one. Nothing is charged now and no date is promised. If you want it, say so in a public comment on the issue below; there is no payment of any kind before I answer there.
Tested on example databases built with the server's table and column names, not yet on a real server's database; if it does not work on yours, an issue on the repo helps. Please do not attach your jellyfin.db to an issue: it holds your server's accounts and access tokens. Describe what you see instead. Movies, shows, episodes and music videos are handled; music, audiobooks and extras are not. Not affiliated with the Jellyfin project; the name is used here only to say which file this page reads. Built with AI assistance, reviewed and tested by me. No cookies, no browser storage, no analytics, no third-party code. MIT licensed, source on GitHub. Younes Z.