Commit graph

1 commit

Author SHA1 Message Date
mithral
c247539ac0 Add the subtitle schema
Vellum had no subtitle support of any kind. This is the storage half.

Three sources, and they are genuinely different shapes: a sidecar file beside
the video has a path, an embedded stream has an index into the container and
no file of its own, and a downloaded track has a path but is regenerable.

stream_index is -1 for the file-backed sources rather than NULL, and that is
deliberate: NULL is never equal to NULL in SQL, so a unique index over a
nullable column would happily accept the same sidecar twice. With -1 the
UNIQUE (item_id, source, path, stream_index) actually does its job and a
rescan can upsert.

Nothing here is authoritative about the media. Deleting every row and
rescanning reproduces it exactly, which is what lets a vanished subtitle file
have its row removed - unlike a vanished video, which is marked instead
(ADR-003) because progress hangs off it and cannot be regenerated.

Verified on both paths: a real database at version 13 upgraded to 14 by an
older binary-then-newer sequence, and a fresh database applied 0001..0014.
2026-10-12 11:33:18 -04:00