feat(db): align movie state with canonical MediaState #85

Merged
naps62-yolo merged 2 commits from issue/73-movie-state into main 2026-08-22 23:21:10 +01:00
Owner

Closes #73.

movies.state used missing|grabbed|imported, predating arr-core's canonical MediaState vocabulary (missing|downloading|available) that series/episodes already follow.

Migration 0007_movie_state_canonical.sql rebuilds the movies table with the new CHECK constraint and renames existing rows in place (grabbed -> downloading, imported -> available). SQLite can't alter a CHECK constraint in place, and the rebuild drops the old table, which would cascade-delete movie_releases through its FK -- the migration stashes those rows and restores them once the new movies table exists with the same ids. The two triggers 0005 defines on movies are recreated for the same reason (DROP TABLE drops triggers with it).

Updated the two places that wrote the old vocabulary (arr-daemon's grab action and its test). Added a regression test that runs the pre-#73 migrations, inserts rows under the old vocabulary, then runs the rest and checks they land on the new names.

Closes #73. `movies.state` used `missing|grabbed|imported`, predating arr-core's canonical `MediaState` vocabulary (`missing|downloading|available`) that series/episodes already follow. Migration `0007_movie_state_canonical.sql` rebuilds the `movies` table with the new `CHECK` constraint and renames existing rows in place (`grabbed` -> `downloading`, `imported` -> `available`). SQLite can't alter a `CHECK` constraint in place, and the rebuild drops the old table, which would cascade-delete `movie_releases` through its FK -- the migration stashes those rows and restores them once the new `movies` table exists with the same ids. The two triggers `0005` defines on `movies` are recreated for the same reason (`DROP TABLE` drops triggers with it). Updated the two places that wrote the old vocabulary (`arr-daemon`'s grab action and its test). Added a regression test that runs the pre-#73 migrations, inserts rows under the old vocabulary, then runs the rest and checks they land on the new names.
naps62-yolo added 2 commits 2026-08-22 23:13:55 +01:00
movies.state used missing|grabbed|imported, predating arr-core's
canonical missing|downloading|available vocabulary that
series/episodes already follow (#73). Migration 0007 rebuilds the
table with the new CHECK constraint and renames existing rows in
place (grabbed -> downloading, imported -> available), stashing and
restoring movie_releases around the swap so its ON DELETE CASCADE
doesn't take those rows out.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
style: cargo fmt
ci / web (pull_request) Successful in 40s
e2e / e2e (pull_request) Successful in 1m3s
ci / rust (pull_request) Successful in 2m37s
6c1900be14
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
naps62-yolo reviewed 2026-08-22 23:16:51 +01:00
naps62-yolo left a comment
Author
Owner

Reviewed 6c1900be14137698bed33149234aa8cbc36d715d. No findings.\n\n

Reviewed `6c1900be14137698bed33149234aa8cbc36d715d`. No findings.\n\n<!-- agent-meta: {"model":"gpt-5","session":"01a02b89"} -->
naps62-yolo merged commit 62aba6315c into main 2026-08-22 23:21:10 +01:00
naps62-yolo deleted branch issue/73-movie-state 2026-08-22 23:21:10 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yolo/arr#85