Commit graph

1 commit

Author SHA1 Message Date
mithral
8d6ea6db20 Add the television schema: seasons and episodes
Vellum had no season or episode model. media_items was a flat tree and the
scanner never parsed S01E02, so a library of television was a list of files
in a folder. That is the difference between a movie server and a media
server, and it is also what blocked TV metadata: there was nothing to
attach a series' poster or overview to.

Schema only. The scanner and the API follow in separate commits, so this
one is safe on its own: the columns are additive and nullable, every
existing row is untouched, and a film keeps NULL for both numbers.

Two decisions, stated in the migration because both are cheap now and
expensive later:

- An EPISODE STAYS kind='video'. A new 'episode' kind would mean touching
  every query that says video for no gain, since the parent chain already
  tells an episode from a film. kind only gains 'series' and 'season'.
- A series and a season have no file, so their path is the directory they
  stand for. That satisfies the existing UNIQUE (library_id, path) and
  gives the row a stable identity so the scanner can upsert instead of
  duplicating a series on every scan.

The tree itself is not new: parent_id already carries albums and audiobook
chapters. This is that same shape applied to television.

Verified on both paths, because only the upgrade can hurt: a database at
version 12 upgraded cleanly to 13 with the columns and both indexes added,
and a fresh database applied 0001..0013 cleanly.
2026-10-12 01:19:06 -04:00