Vellum/migrations
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
..
0001_core.sql Phase 0: skeleton, config, migrations, health check, container 2026-10-09 16:26:08 -04:00
0002_missing.sql Phase 2: libraries and the file scanner 2026-10-09 16:33:56 -04:00
0003_search.sql Phase 2b: FTS5 search 2026-10-09 21:10:44 -04:00
0004_metadata.sql Phase 5: job queue and metadata providers 2026-10-09 21:16:07 -04:00
0005_games.sql Phase 7: games — ROM scanning, platforms, cloud saves, EmulatorJS 2026-10-09 21:54:49 -04:00
0006_views.sql Home: five sections — Continue, Most Viewed, Suggestions, Recently Added, Explore 2026-10-10 16:59:39 -04:00
0007_job_ref.sql Beta blockers: async scans, admin CLI, deploy docs, pagination, password UI 2026-10-10 18:00:35 -04:00
0008_query_indexes.sql Wave 1: survive a real library 2026-10-11 13:10:34 -04:00
0009_search_authors.sql Wave 3: search depth, transfer size, and the Home screen's tests 2026-10-11 13:46:18 -04:00
0010_media_probe.sql Waves 4-6: audio depth, ffprobe facts, and direct-play video 2026-10-11 14:14:32 -04:00
0011_missing_since.sql Waves 7-8: playback engine selection, and missing files you can see 2026-10-11 14:36:55 -04:00
0012_api_tokens.sql Waves 9-10: Jellyfin and Subsonic clients can browse and play 2026-10-11 15:05:43 -04:00
0013_series.sql Add the television schema: seasons and episodes 2026-10-12 01:19:06 -04:00
embed.go Phase 0: skeleton, config, migrations, health check, container 2026-10-09 16:26:08 -04:00