Skip to content

Support storing how many plays media has and other database improvements#1059

Merged
IRHM merged 27 commits into
devfrom
fix-includePreviouslyWatched-regression
Jul 5, 2026
Merged

Support storing how many plays media has and other database improvements#1059
IRHM merged 27 commits into
devfrom
fix-includePreviouslyWatched-regression

Conversation

@IRHM

@IRHM IRHM commented Jul 5, 2026

Copy link
Copy Markdown
Member

Changes

Changes made in this PR as they are shown in the CHANGELOG.

Data migrations

This is the first time migrations are being taken place when updating Watcharr, please be mindful of that and ensure you have your existing database backed up incase of any errors.

Backfilling plays data from users Activity.

This migration was added so that existing data could be used to fill out how many plays of your media you have. It can't be 100% accurate because it has to make some assumptions, but it can get close and saves you a lot of time.

Dropping deleted_at columns for watched_seasons and watched_episodes tables since we do not use them.

I noticed that queries (eg for loading your main list) would take an extra ~100ms because we were adding a deleted_at IS NULL to them when getting watched seasons/episodes. We don't use the deleted_at column, so I have just removed it from the tables (and queries so we have the speed boost).

Moving to using WAL journal_mode for our sqlite database, which will grant us improvements in all areas.

Most database operations will be much faster now and more concurrent use of the database is now possible.

Important Note About Backups

You will notice that the database now comprises of three files: watcharr.db (which has always been there) and watcharr.db-wal, watcharr.db-shm (which are new).

If you backup your database by copying the .db file (while your server is stopped of course), you should also copy the watcharr.db-wal file since it can contain database content. You can ignore the watcharr.db-shm file if you want.

Added

  • DB: Add custom migrations support.
  • Activity: New CountAsPlay property for tracking media total plays (this will speed up counting plays since we'll no longer rely on text searches in the db).
    • Migration: Backfill media plays data from existing user activity, so no one has to start from 0 plays when they already have data we can use to get their total plays.
  • Add link to names of top crew members.
  • Return Plays in WatchedDto where used.
  • Show plays count for media in MyReview component.
  • Activity: Show icon for activity that counts as a play.

Changed

  • Moved db to WAL journal_mode.
  • WatchedUpdateRequest: Manually validate instead of using complex struct tags.
    • Now properly validating WatchedStatus.

Fixed

  • import: myanimelist: Don't import start/finish dates when they are empty.
  • Star and Play icons color.
  • Activity: Fixed automation tooltip going out of bounds by moving it to top.

Removed

  • Drop deleted_at columns for watched episode/season tables.
  • Removed AddActivity (POST /activity) endpoint (Thanks [@Dredsen] for pointing out the flaw).

Documentation

  • Backup: Also note that watcharr.db-wal should be backed up along with the .db file since v3.

IRHM and others added 27 commits June 27, 2026 23:18
We don't use these columns and won't in the foreseeable future. Query speed seems be to be faster now that we aren't filtering for the extra deleted_at cols.
…to FULL

(did this work a long time ago now so commits are in weird order)
it isn't used and is only a way for others to potentially add activity to other peoples watched entries since user owning the watched entry is not validated on the endpoint.

Co-Authored-By: Dreddy <24421368+dredsen@users.noreply.github.com>
soz did this so long ago
Having the changelog file is one more step to no vendor lock-in. It's also more easily searched through and in a standard format everyone is probably used to.

Just so you know, this was painful and I wanted nothing but death for myself throughout this whole process.
@IRHM IRHM added this to the v3.0.2 milestone Jul 5, 2026
@IRHM IRHM self-assigned this Jul 5, 2026
@IRHM IRHM added the bug Hmm, this isn't working correctly label Jul 5, 2026
@IRHM IRHM added this to Watcharr Jul 5, 2026
@IRHM IRHM added the enhancement New feature or request label Jul 5, 2026
@IRHM IRHM moved this to In Progress in Watcharr Jul 5, 2026
@IRHM IRHM merged commit 3461a4e into dev Jul 5, 2026
3 checks passed
@IRHM IRHM deleted the fix-includePreviouslyWatched-regression branch July 5, 2026 17:39
@IRHM IRHM moved this from In Progress to Awaiting Dev Build in Watcharr Jul 5, 2026
@IRHM IRHM moved this from Awaiting Dev Build to Done in Watcharr Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Hmm, this isn't working correctly enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant